diff --git a/src/cloud-api-adaptor/test/e2e/azure_test.go b/src/cloud-api-adaptor/test/e2e/azure_test.go index 2db632ada..5c0bf76cc 100644 --- a/src/cloud-api-adaptor/test/e2e/azure_test.go +++ b/src/cloud-api-adaptor/test/e2e/azure_test.go @@ -135,6 +135,9 @@ func TestKbsKeyRelease(t *testing.T) { testSecret := envconf.RandomName("coco-pp-e2e-secret", 25) resourcePath := "reponame/workload_key/test_key.bin" err := keyBrokerService.SetSecret(resourcePath, []byte(testSecret)) + if err != nil { + t.Errorf("unexpected error: %v", err) + } DoTestKbsKeyRelease(t, testEnv, assert, kbsEndpoint, resourcePath, testSecret) } diff --git a/src/cloud-api-adaptor/test/e2e/docker_test.go b/src/cloud-api-adaptor/test/e2e/docker_test.go index 5555ab431..b24d6ed72 100644 --- a/src/cloud-api-adaptor/test/e2e/docker_test.go +++ b/src/cloud-api-adaptor/test/e2e/docker_test.go @@ -105,13 +105,25 @@ func TestDockerKbsKeyRelease(t *testing.T) { } testSecret := envconf.RandomName("coco-pp-e2e-secret", 25) resourcePath := "reponame/workload_key/test_key.bin" - keyBrokerService.SetSecret(resourcePath, []byte(testSecret)) - keyBrokerService.EnableKbsCustomizedResourcePolicy("deny_all.rego") - kbsEndpoint, _ := keyBrokerService.GetCachedKbsEndpoint() + err := keyBrokerService.SetSecret(resourcePath, []byte(testSecret)) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + err = keyBrokerService.EnableKbsCustomizedResourcePolicy("deny_all.rego") + if err != nil { + t.Errorf("unexpected error: %v", err) + } + kbsEndpoint, err := keyBrokerService.GetCachedKbsEndpoint() + if err != nil { + t.Errorf("unexpected error: %v", err) + } assert := DockerAssert{} t.Parallel() DoTestKbsKeyReleaseForFailure(t, testEnv, assert, kbsEndpoint, resourcePath, testSecret) - keyBrokerService.EnableKbsCustomizedResourcePolicy("allow_all.rego") + err = keyBrokerService.EnableKbsCustomizedResourcePolicy("allow_all.rego") + if err != nil { + t.Errorf("unexpected error: %v", err) + } DoTestKbsKeyRelease(t, testEnv, assert, kbsEndpoint, resourcePath, testSecret) } diff --git a/src/cloud-api-adaptor/test/e2e/libvirt_test.go b/src/cloud-api-adaptor/test/e2e/libvirt_test.go index 9fcbe4d7e..e0a582878 100644 --- a/src/cloud-api-adaptor/test/e2e/libvirt_test.go +++ b/src/cloud-api-adaptor/test/e2e/libvirt_test.go @@ -116,10 +116,22 @@ func TestLibvirtKbsKeyRelease(t *testing.T) { testSecret := envconf.RandomName("coco-pp-e2e-secret", 25) resourcePath := "reponame/workload_key/test_key.bin" - _ = keyBrokerService.SetSecret(resourcePath, []byte(testSecret)) - _ = keyBrokerService.EnableKbsCustomizedResourcePolicy("allow_all.rego") - _ = keyBrokerService.EnableKbsCustomizedAttestationPolicy("deny_all.rego") - kbsEndpoint, _ := keyBrokerService.GetCachedKbsEndpoint() + err := keyBrokerService.SetSecret(resourcePath, []byte(testSecret)) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + err = keyBrokerService.EnableKbsCustomizedResourcePolicy("allow_all.rego") + if err != nil { + t.Errorf("unexpected error: %v", err) + } + err = keyBrokerService.EnableKbsCustomizedAttestationPolicy("deny_all.rego") + if err != nil { + t.Errorf("unexpected error: %v", err) + } + kbsEndpoint, err := keyBrokerService.GetCachedKbsEndpoint() + if err != nil { + t.Errorf("unexpected error: %v", err) + } assert := LibvirtAssert{} t.Parallel() DoTestKbsKeyReleaseForFailure(t, testEnv, assert, kbsEndpoint, resourcePath, testSecret) @@ -127,13 +139,22 @@ func TestLibvirtKbsKeyRelease(t *testing.T) { t.Log("KBS with ibmse cases") // the allow_*_.rego file is created by follow document // https://github.com/confidential-containers/trustee/blob/main/deps/verifier/src/se/README.md#set-attestation-policy - _ = keyBrokerService.EnableKbsCustomizedAttestationPolicy("allow_with_wrong_image_tag.rego") + err = keyBrokerService.EnableKbsCustomizedAttestationPolicy("allow_with_wrong_image_tag.rego") + if err != nil { + t.Errorf("unexpected error: %v", err) + } DoTestKbsKeyReleaseForFailure(t, testEnv, assert, kbsEndpoint, resourcePath, testSecret) - _ = keyBrokerService.EnableKbsCustomizedAttestationPolicy("allow_with_correct_claims.rego") + err = keyBrokerService.EnableKbsCustomizedAttestationPolicy("allow_with_correct_claims.rego") + if err != nil { + t.Errorf("unexpected error: %v", err) + } DoTestKbsKeyRelease(t, testEnv, assert, kbsEndpoint, resourcePath, testSecret) } else { t.Log("KBS normal cases") - _ = keyBrokerService.EnableKbsCustomizedAttestationPolicy("allow_all.rego") + err = keyBrokerService.EnableKbsCustomizedAttestationPolicy("allow_all.rego") + if err != nil { + t.Errorf("unexpected error: %v", err) + } DoTestKbsKeyRelease(t, testEnv, assert, kbsEndpoint, resourcePath, testSecret) } }