From 451800fde411f77cd35012ce56567932b3b203ce 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 | 45 ++++++++++++++++++++++ 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/test/e2e/minimal_configuration_test.go b/test/e2e/minimal_configuration_test.go index cb56430f5..0195c45c4 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..23383af8f 100644 --- a/test/e2e/resources/full-chart-install.yaml +++ b/test/e2e/resources/full-chart-install.yaml @@ -1482,6 +1482,15 @@ 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. This should be an inline yaml blob-string https://datatracker.ietf.org/doc/html/rfc7396 + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -4566,6 +4575,15 @@ 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. This should be an inline yaml blob-string https://datatracker.ietf.org/doc/html/rfc7396 + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -7653,6 +7671,15 @@ 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. This should be an inline yaml blob-string https://datatracker.ietf.org/doc/html/rfc7396 + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -10738,6 +10765,15 @@ 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. This should be an inline yaml blob-string https://datatracker.ietf.org/doc/html/rfc7396 + items: + type: string + type: array version: description: Version indicates the provider version. type: string @@ -13825,6 +13861,15 @@ 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. This should be an inline yaml blob-string https://datatracker.ietf.org/doc/html/rfc7396 + items: + type: string + type: array version: description: Version indicates the provider version. type: string