Skip to content

Commit

Permalink
test/e2e: azure: Refactor out TestTrusteeOperatorKeyReleaseForSpecifi…
Browse files Browse the repository at this point in the history
…cKey

Now the `DoTestKbsKeyRelease` test can have
customised secret and resource path, we can re-use
it for the trustee test

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
  • Loading branch information
stevenhorsman committed Sep 24, 2024
1 parent 0bf704b commit 2c16530
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/test/e2e/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,5 @@ func TestTrusteeOperatorKeyReleaseForSpecificKey(t *testing.T) {
}
t.Parallel()
kbsEndpoint, _ := keyBrokerService.GetCachedKbsEndpoint()
DoTestTrusteeOperatorKeyReleaseForSpecificKey(t, testEnv, assert, kbsEndpoint)
DoTestKbsKeyRelease(t, testEnv, assert, kbsEndpoint, "default/kbsres1/key1", "res1val1")
}
23 changes: 0 additions & 23 deletions src/cloud-api-adaptor/test/e2e/common_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,29 +599,6 @@ func DoTestKbsKeyReleaseForFailure(t *testing.T, e env.Environment, assert Cloud
NewTestCase(t, e, "DoTestKbsKeyReleaseForFailure", assert, "Kbs key release is failed").WithPod(pod).WithTestCommands(testCommands).Run()
}

// Test to check for specific key value from Trustee Operator Deployment
func DoTestTrusteeOperatorKeyReleaseForSpecificKey(t *testing.T, e env.Environment, assert CloudAssert, kbsEndpoint string) {
t.Log("Do test Trustee operator key release for specific key")
pod := NewBusyboxPodWithNameWithInitdata(E2eNamespace, "op-key-release", kbsEndpoint)
testCommands := []TestCommand{
{
Command: []string{"wget", "-q", "-O-", "http://127.0.0.1:8006/cdh/resource/default/kbsres1/key1"},
ContainerName: pod.Spec.Containers[0].Name,
TestCommandStdoutFn: func(stdout bytes.Buffer) bool {
if strings.Contains(stdout.String(), "res1val1") {
t.Logf("Success to get key %s", stdout.String())
return true
} else {
t.Errorf("Failed to access key: %s", stdout.String())
return false
}
},
},
}

NewTestCase(t, e, "KbsKeyReleasePod", assert, "Kbs key release from Trustee Operator is successful").WithPod(pod).WithTestCommands(testCommands).Run()
}

func DoTestRestrictivePolicyBlocksExec(t *testing.T, e env.Environment, assert CloudAssert) {
allowAllExceptExecPolicyFilePath := "fixtures/policies/allow-all-except-exec-process.rego"
podName := "policy-exec-rejected"
Expand Down

0 comments on commit 2c16530

Please sign in to comment.