tadayosi commented on code in PR #3330: URL: https://github.com/apache/camel-k/pull/3330#discussion_r889649928
########## pkg/trait/pod_test.go: ########## @@ -138,6 +150,9 @@ func createPodTest(podSpecTemplate string) (*podTrait, *Environment, *appsv1.Dep }, }, }, + SecurityContext: &corev1.PodSecurityContext{ Review Comment: No, the returned deployment is the "actual" case. Otherwise, these assertions you added do not test anything, as the object and value here are provided by the tester. ``` // Check if securityContext was added assert.NotNil(t, templateSpec.Spec) assert.NotNil(t, templateSpec.Spec.SecurityContext) assert.NotNil(t, templateSpec.Spec.SecurityContext.SupplementalGroups) assert.Contains(t, templateSpec.Spec.SecurityContext.SupplementalGroups, int64(666)) ``` You don't want to remove the SecurityContext lines (starting from line 153) because otherwise the test doesn't pass. But as I said it should really pass without the lines. Why it doens't pass is actually that the test `pod_test.go` itself has a potential problem and needs to be fixed. Look at the code: https://github.com/apache/camel-k/blob/main/pkg/trait/pod_test.go#L95-L98 ``` var podSpec v1.PodSpec if podSpecTemplate != "" { _ = yaml.Unmarshal([]byte(podSpecTemplate), &podSpec) } ``` It actually doesn't do any unmarshalling on `podSpec` (check by inserting some println on `podSpec`). It is the root cause of the issue. We need to see why it doesn't as expected and fix it before merging the fix. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org