From a55aa4a23d35ee80a2115801f5db791be7be8a2f Mon Sep 17 00:00:00 2001 From: PetarTodorovv <31803034+PetarTodorovv@users.noreply.github.com> Date: Wed, 6 Jul 2022 10:56:57 +0300 Subject: [PATCH] [HOTFIX] Fix runtime contexts tests' external cert configuration (#2471) * Fix runtime contexts tests' external cert configuration * minor change --- .../templates/tests/director/director-test.yaml | 2 ++ chart/compass/values.yaml | 2 +- tests/director/tests/main_test.go | 1 + tests/director/tests/runtime_contexts_api_test.go | 15 ++++++++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/chart/compass/templates/tests/director/director-test.yaml b/chart/compass/templates/tests/director/director-test.yaml index 6b7ee40859..b2814de389 100644 --- a/chart/compass/templates/tests/director/director-test.yaml +++ b/chart/compass/templates/tests/director/director-test.yaml @@ -161,6 +161,8 @@ spec: value: {{ .Values.global.director.subscription.subscriptionLabelKey }} - name: SKIP_TESTS_REGEX value: {{ .Values.global.tests.director.skipPattern }} + - name: APP_EXTERNAL_CERT_TEST_CN + value: {{ .Values.global.tests.director.externalCertIntSystemCN }} {{ if .Values.global.isLocalEnv }} volumeMounts: - mountPath: "/src/github.com/kyma-incubator/compass/components/director/examples" diff --git a/chart/compass/values.yaml b/chart/compass/values.yaml index d7f917dfbf..d8b53dc5b1 100644 --- a/chart/compass/values.yaml +++ b/chart/compass/values.yaml @@ -142,7 +142,7 @@ global: version: "PR-68" e2e_tests: dir: - version: "PR-2438" + version: "PR-2471" isLocalEnv: false isForTesting: false oauth2: diff --git a/tests/director/tests/main_test.go b/tests/director/tests/main_test.go index dede06ff43..5a405328c8 100644 --- a/tests/director/tests/main_test.go +++ b/tests/director/tests/main_test.go @@ -46,6 +46,7 @@ type DirectorConfig struct { SubscriptionLabelKey string RuntimeTypeLabelKey string KymaRuntimeTypeLabelValue string + ExternalCertTestCN string } type BaseDirectorConfig struct { diff --git a/tests/director/tests/runtime_contexts_api_test.go b/tests/director/tests/runtime_contexts_api_test.go index ce8bb1a96a..508d8225e4 100644 --- a/tests/director/tests/runtime_contexts_api_test.go +++ b/tests/director/tests/runtime_contexts_api_test.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "net/http" + "strings" "testing" "time" @@ -168,8 +169,20 @@ func TestRuntimeContextSubscriptionFlows(stdT *testing.T) { subscriptionConsumerSubaccountID := conf.TestConsumerSubaccountID // the parent is ApplicationsForRuntimeTenantName subscriptionConsumerTenantID := conf.TestConsumerTenantID + // We need an externally issued cert with a subject that is not part of the access level mappings + externalCertProviderConfig := certprovider.ExternalCertProviderConfig{ + ExternalClientCertTestSecretName: conf.ExternalCertProviderConfig.ExternalClientCertTestSecretName, + ExternalClientCertTestSecretNamespace: conf.ExternalCertProviderConfig.ExternalClientCertTestSecretNamespace, + CertSvcInstanceTestSecretName: conf.ExternalCertProviderConfig.CertSvcInstanceTestSecretName, + ExternalCertCronjobContainerName: conf.ExternalCertProviderConfig.ExternalCertCronjobContainerName, + ExternalCertTestJobName: conf.ExternalCertProviderConfig.ExternalCertTestJobName, + TestExternalCertSubject: strings.Replace(conf.ExternalCertProviderConfig.TestExternalCertSubject, conf.ExternalCertTestCN, "rtm-ctx-test-cn", -1), + ExternalClientCertCertKey: conf.ExternalCertProviderConfig.ExternalClientCertCertKey, + ExternalClientCertKeyKey: conf.ExternalCertProviderConfig.ExternalClientCertKeyKey, + } + // Prepare provider external client certificate and secret and Build graphql director client configured with certificate - providerClientKey, providerRawCertChain := certprovider.NewExternalCertFromConfig(t, ctx, conf.ExternalCertProviderConfig) + providerClientKey, providerRawCertChain := certprovider.NewExternalCertFromConfig(t, ctx, externalCertProviderConfig) directorCertSecuredClient := gql.NewCertAuthorizedGraphQLClientWithCustomURL(conf.DirectorExternalCertSecuredURL, providerClientKey, providerRawCertChain, conf.SkipSSLValidation) providerRuntimeInput := graphql.RuntimeRegisterInput{