This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 18c52302be82af5e34221164acc298c3d5560828
Author: Tadayoshi Sato <[email protected]>
AuthorDate: Mon Jun 6 14:28:26 2022 +0900

    fix(e2e): stabilise TestPodTrait
---
 e2e/common/traits/pod_test.go | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/e2e/common/traits/pod_test.go b/e2e/common/traits/pod_test.go
index 9fe447090..3f12895bd 100644
--- a/e2e/common/traits/pod_test.go
+++ b/e2e/common/traits/pod_test.go
@@ -43,6 +43,7 @@ func TestPodTrait(t *testing.T) {
                {
                        name:         "pod trait with env vars and volume 
mounts",
                        templateName: "files/template.yaml",
+                       // nolint: thelper
                        assertions: func(t *testing.T, ns string, name string) {
                                // check that integrations is working and 
reading data created by sidecar container
                                Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Content from the sidecar container"))
@@ -58,12 +59,19 @@ func TestPodTrait(t *testing.T) {
                {
                        name:         "pod trait with supplemental groups",
                        templateName: 
"files/template-with-supplemental-groups.yaml",
+                       // nolint: thelper
                        assertions: func(t *testing.T, ns string, name string) {
-                               pod := IntegrationPod(ns, name)()
-                               Expect(pod.Spec).NotTo(BeNil())
-                               Expect(pod.Spec.SecurityContext).NotTo(BeNil())
-                               
Expect(pod.Spec.SecurityContext.SupplementalGroups).NotTo(BeNil())
-                               
Expect(pod.Spec.SecurityContext.SupplementalGroups).Should(ContainElements(int64(666)))
+                               Eventually(IntegrationPodHas(ns, name, func(pod 
*corev1.Pod) bool {
+                                       if pod.Spec.SecurityContext == nil {
+                                               return false
+                                       }
+                                       for _, sg := range 
pod.Spec.SecurityContext.SupplementalGroups {
+                                               if sg == 666 {
+                                                       return true
+                                               }
+                                       }
+                                       return false
+                               }), TestTimeoutShort).Should(BeTrue())
                        },
                },
        }

Reply via email to