From 61ef281bfed066b23b653443d5d3ef18a00876f4 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 c575c8103c..fdb969b057 100644 --- a/src/cloud-api-adaptor/test/e2e/common_suite.go +++ b/src/cloud-api-adaptor/test/e2e/common_suite.go @@ -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())