Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
[HOTFIX] Fix runtime contexts tests' external cert configuration (#2471)
Browse files Browse the repository at this point in the history
* Fix runtime contexts tests' external cert configuration

* minor change
  • Loading branch information
PetarTodorovv authored Jul 6, 2022
1 parent dee50f1 commit a55aa4a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions chart/compass/templates/tests/director/director-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion chart/compass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ global:
version: "PR-68"
e2e_tests:
dir:
version: "PR-2438"
version: "PR-2471"
isLocalEnv: false
isForTesting: false
oauth2:
Expand Down
1 change: 1 addition & 0 deletions tests/director/tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type DirectorConfig struct {
SubscriptionLabelKey string
RuntimeTypeLabelKey string
KymaRuntimeTypeLabelValue string
ExternalCertTestCN string
}

type BaseDirectorConfig struct {
Expand Down
15 changes: 14 additions & 1 deletion tests/director/tests/runtime_contexts_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit a55aa4a

Please sign in to comment.