Skip to content

Commit

Permalink
fix sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
susanshi committed Oct 13, 2023
1 parent 75a5de9 commit ada7ba6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pkg/controllers/verifier_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
7 changes: 5 additions & 2 deletions pkg/verifier/notation/notation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/bats/base-test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit ada7ba6

Please sign in to comment.