From edbe6ef200859c6f9b3c2a411ac2691f0b9cff8b Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Thu, 3 Oct 2024 19:02:50 -0300 Subject: [PATCH] test/e2e: adapt DoTestRestrictivePolicyBlocksExec for CRI-O 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 --- src/cloud-api-adaptor/test/e2e/common_suite.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cloud-api-adaptor/test/e2e/common_suite.go b/src/cloud-api-adaptor/test/e2e/common_suite.go index 13a4dce61..08c22b91f 100644 --- a/src/cloud-api-adaptor/test/e2e/common_suite.go +++ b/src/cloud-api-adaptor/test/e2e/common_suite.go @@ -626,8 +626,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())