From ada7ba647de70dbf30af6784fe0e006f39a78416 Mon Sep 17 00:00:00 2001 From: "huish@microsoft.com" Date: Fri, 13 Oct 2023 05:15:27 +0000 Subject: [PATCH] fix sleep --- pkg/controllers/verifier_controller_test.go | 8 ++++---- pkg/verifier/notation/notation.go | 7 +++++-- test/bats/base-test.bats | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkg/controllers/verifier_controller_test.go b/pkg/controllers/verifier_controller_test.go index b0c05e235..50dc32224 100644 --- a/pkg/controllers/verifier_controller_test.go +++ b/pkg/controllers/verifier_controller_test.go @@ -105,19 +105,19 @@ func TestGetCertStoreNamespace(t *testing.T) { t.Fatalf("env not set should trigger an error") } - ratifyDeployedNamespace := "samplens" + ratifyDeployedNamespace := "sample" os.Setenv(ratifyNamespaceEnvVar, ratifyDeployedNamespace) defer os.Unsetenv(ratifyNamespaceEnvVar) - // scenario1, when defualt namespace is provided, then we should expect default + // scenario1, when default namespace is provided, then we should expect default verifierNamespace := "verifierNamespace" - ns, err := getCertStoreNamespace(verifierNamespace) + ns, _ := getCertStoreNamespace(verifierNamespace) if ns != verifierNamespace { t.Fatalf("default namespace expected") } // scenario2, default is empty, should return ratify installed namespace - ns, err = getCertStoreNamespace("") + ns, _ = getCertStoreNamespace("") if ns != ratifyDeployedNamespace { t.Fatalf("default namespace expected") } diff --git a/pkg/verifier/notation/notation.go b/pkg/verifier/notation/notation.go index d4e369a95..39a71620f 100644 --- a/pkg/verifier/notation/notation.go +++ b/pkg/verifier/notation/notation.go @@ -182,14 +182,17 @@ func parseVerifierConfig(verifierConfig config.VerifierConfig, namespace string) // append verifier's namespace to uniquely identify the certstore // TODO add unit test if len(conf.VerificationCertStores) > 0 { - for i, certStores := range conf.VerificationCertStores { + /*for i, certStores := range conf.VerificationCertStores { for j, certstore := range conf.VerificationCertStores[i] { if !strings.Contains(certstore, "/") { certStores[j] = namespace + "/" + certstore } } + }*/ + conf.VerificationCertStores, err = appendNamespaceToCertStore(conf.VerificationCertStores, namespace) + if err != nil { + return nil, err } - //conf.VerificationCertStores, err = appendNamespaceToCertStore(conf.VerificationCertStores, namespace) } defaultCertsDir := paths.Join(homedir.Get(), ratifyconfig.ConfigFileDir, defaultCertPath) diff --git a/test/bats/base-test.bats b/test/bats/base-test.bats index 9d54feab5..b362c2cb1 100644 --- a/test/bats/base-test.bats +++ b/test/bats/base-test.bats @@ -4,7 +4,7 @@ load helpers BATS_TESTS_DIR=${BATS_TESTS_DIR:-test/bats/tests} WAIT_TIME=60 -SLEEP_TIME= +SLEEP_TIME=1 RATIFY_NAMESPACE=gatekeeper-system @test "base test without cert rotator" {