From ca8d7fb91314c46a6832084a3080b29120ead8d0 Mon Sep 17 00:00:00 2001 From: alexander-demicev Date: Thu, 12 Oct 2023 20:31:24 +0200 Subject: [PATCH] Add e2e tests for json patches Signed-off-by: alexander-demicev --- test/e2e/minimal_configuration_test.go | 23 ++++++++-- test/e2e/resources/full-chart-install.yaml | 50 ++++++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/test/e2e/minimal_configuration_test.go b/test/e2e/minimal_configuration_test.go index c42292ff6..a940c75b5 100644 --- a/test/e2e/minimal_configuration_test.go +++ b/test/e2e/minimal_configuration_test.go @@ -69,6 +69,11 @@ data: AdditionalManifestsRef: &operatorv1.ConfigmapReference{ Name: additionalManifests.Name, }, + ManifestPatches: []string{`apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + test-label: test-value`}, }, }, } @@ -83,6 +88,15 @@ data: Deployment: &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: coreProviderDeploymentName, Namespace: operatorNamespace}}, }, e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...) + By("Checking for deployment to have additional labels") + deployment := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: coreProviderDeploymentName, Namespace: operatorNamespace}} + WaitFor(ctx, For(deployment).In(bootstrapCluster).ToSatisfy(func() bool { + if v, ok := deployment.Labels["test-label"]; ok { + return v == "test-value" + } + return false + }), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...) + By("Waiting for core provider to be ready") WaitFor(ctx, For(coreProvider).In(bootstrapCluster).ToSatisfy( HaveStatusCondition(&coreProvider.Status.Conditions, operatorv1.ProviderInstalledCondition)), @@ -94,10 +108,11 @@ data: }), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...) By("Checking if additional manifests are applied") - cm := &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{ - Name: "test-config-map", - Namespace: operatorNamespace, - }} + cm := &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-config-map", + Namespace: operatorNamespace, + }} WaitFor(ctx, For(cm).In(bootstrapCluster).ToSatisfy(func() bool { value, ok := cm.Data["test"] return ok && value == "test" diff --git a/test/e2e/resources/full-chart-install.yaml b/test/e2e/resources/full-chart-install.yaml index c0ebbe81b..f439c10bf 100644 --- a/test/e2e/resources/full-chart-install.yaml +++ b/test/e2e/resources/full-chart-install.yaml @@ -1482,6 +1482,16 @@ spec: type: integer type: object type: object + manifestPatches: + description: "ManifestPatches are applied to rendered provider manifests + to customize the provider manifests. Patches are applied in the + order they are specified. The `kind` field must match the target + object, and if `apiVersion` is specified it will only be applied + to matching objects. \n This should be an inline yaml blob-string + \n https://tools.ietf.org/html/rfc7386" + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -4566,6 +4576,16 @@ spec: type: integer type: object type: object + manifestPatches: + description: "ManifestPatches are applied to rendered provider manifests + to customize the provider manifests. Patches are applied in the + order they are specified. The `kind` field must match the target + object, and if `apiVersion` is specified it will only be applied + to matching objects. \n This should be an inline yaml blob-string + \n https://tools.ietf.org/html/rfc7386" + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -7653,6 +7673,16 @@ spec: type: integer type: object type: object + manifestPatches: + description: "ManifestPatches are applied to rendered provider manifests + to customize the provider manifests. Patches are applied in the + order they are specified. The `kind` field must match the target + object, and if `apiVersion` is specified it will only be applied + to matching objects. \n This should be an inline yaml blob-string + \n https://tools.ietf.org/html/rfc7386" + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -10738,6 +10768,16 @@ spec: type: integer type: object type: object + manifestPatches: + description: "ManifestPatches are applied to rendered provider manifests + to customize the provider manifests. Patches are applied in the + order they are specified. The `kind` field must match the target + object, and if `apiVersion` is specified it will only be applied + to matching objects. \n This should be an inline yaml blob-string + \n https://tools.ietf.org/html/rfc7386" + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -13825,6 +13865,16 @@ spec: type: integer type: object type: object + manifestPatches: + description: "ManifestPatches are applied to rendered provider manifests + to customize the provider manifests. Patches are applied in the + order they are specified. The `kind` field must match the target + object, and if `apiVersion` is specified it will only be applied + to matching objects. \n This should be an inline yaml blob-string + \n https://tools.ietf.org/html/rfc7386" + items: + type: string + type: array version: description: Version indicates the provider version. type: string