fix(e2e): stabilise TestPodTrait
@@ -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())
},
},
}
