Skip to content

Commit

Permalink
test/e2e: adapt DoTestRestrictivePolicyBlocksExec for CRI-O
Browse files Browse the repository at this point in the history
The DoTestRestrictivePolicyBlocksExec test for CRI-O will have the
"error executing command in container" error message instead of
"failed to exec in container". So adjusted the expected strings on
the error message to consider the output of CRI-O too.

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
  • Loading branch information
wainersm committed Oct 3, 2024
1 parent a33d3aa commit 61ef281
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cloud-api-adaptor/test/e2e/common_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,10 @@ func DoTestRestrictivePolicyBlocksExec(t *testing.T, e env.Environment, assert C
Command: []string{"ls"},
ContainerName: pod.Spec.Containers[0].Name,
TestErrorFn: func(err error) bool {
if strings.Contains(err.Error(), "failed to exec in container") && strings.Contains(err.Error(), "ExecProcessRequest is blocked by policy") {
t.Logf("Exec process was blocked %s", err.Error())
if (strings.Contains(err.Error(), "failed to exec in container") || // containerd
strings.Contains(err.Error(), "error executing command in container")) && // cri-o
strings.Contains(err.Error(), "ExecProcessRequest is blocked by policy") {
t.Logf("Exec process was blocked: %s", err.Error())
return true
} else {
t.Errorf("Exec process was allowed: %s", err.Error())
Expand Down

0 comments on commit 61ef281

Please sign in to comment.