Skip to content

Commit

Permalink
fix: CLI integration test for unmanaged pod with two containers (#738)
Browse files Browse the repository at this point in the history
It seems that trivy cannot scan tomcat:8 container image.
Changing to redis:5 as a quick win until the problem
is fixed in trivy for real.

Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
  • Loading branch information
danielpacak authored Oct 8, 2021
1 parent a986a4e commit 0b9a97c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions itest/starboard/starboard_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,17 @@ var _ = Describe("Starboard CLI", func() {

Context("when unmanaged Pod with multiple containers is specified as workload", func() {

var ctx context.Context
var pod *corev1.Pod

BeforeEach(func() {
pod = helper.NewPod().WithName("nginx-and-tomcat").
ctx = context.TODO()
pod = helper.NewPod().WithRandomName("nginx-and-redis").
WithNamespace(testNamespace.Name).
WithContainer("nginx-container", "nginx:1.16").
WithContainer("tomcat-container", "tomcat:8").
WithContainer("redis-container", "redis:5").
Build()
err := kubeClient.Create(context.TODO(), pod)
err := kubeClient.Create(ctx, pod)
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -262,20 +264,20 @@ var _ = Describe("Starboard CLI", func() {
Expect(err).ToNot(HaveOccurred())

var reportList v1alpha1.VulnerabilityReportList
err = kubeClient.List(context.TODO(), &reportList, client.MatchingLabels{
err = kubeClient.List(ctx, &reportList, client.MatchingLabels{
starboard.LabelResourceKind: string(kube.KindPod),
starboard.LabelResourceName: pod.Name,
starboard.LabelResourceNamespace: pod.Namespace,
})
Expect(err).ToNot(HaveOccurred())
Expect(reportList.Items).To(MatchAllElements(groupByContainerName, Elements{
"nginx-container": IsVulnerabilityReportForContainerOwnedBy("nginx-container", pod),
"tomcat-container": IsVulnerabilityReportForContainerOwnedBy("tomcat-container", pod),
"nginx-container": IsVulnerabilityReportForContainerOwnedBy("nginx-container", pod),
"redis-container": IsVulnerabilityReportForContainerOwnedBy("redis-container", pod),
}))
})

AfterEach(func() {
err := kubeClient.Delete(context.TODO(), pod)
err := kubeClient.Delete(ctx, pod)
Expect(err).ToNot(HaveOccurred())
})

Expand Down

0 comments on commit 0b9a97c

Please sign in to comment.