Skip to content

Commit a00fa19

Browse files
chris-rockclaude
andauthored
Use smaller container images in integration tests (#1388)
Replace nginx-unprivileged (~58MB) and redis (~18MB) with pause (~300KB) and busybox (~1.5MB) to speed up image pulls and reduce flakiness in container scan tests. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 13f69a8 commit a00fa19

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

tests/integration/audit_config_base_suite.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ func (s *AuditConfigBaseSuite) testMondooAuditConfigKubernetesResources(auditCon
208208
}
209209

210210
func (s *AuditConfigBaseSuite) testMondooAuditConfigContainers(auditConfig mondoov2.MondooAuditConfig) {
211-
nginxLabel := "app.kubernetes.io/name=nginx"
212-
_, err := s.testCluster.K8sHelper.Kubectl("run", "-n", "default", "nginx", "--image", "ghcr.io/nginx/nginx-unprivileged", "-l", nginxLabel)
213-
s.Require().NoError(err, "Failed to create nginx pod.")
214-
redisLabel := "app.kubernetes.io/name=redis"
215-
_, err = s.testCluster.K8sHelper.Kubectl("run", "-n", "default", "redis", "--image", "quay.io/opstree/redis", "-l", redisLabel)
216-
s.Require().NoError(err, "Failed to create redis pod.")
217-
218-
s.True(s.testCluster.K8sHelper.IsPodReady(nginxLabel, "default"), "nginx pod is not ready")
219-
s.True(s.testCluster.K8sHelper.IsPodReady(redisLabel, "default"), "redis pod is not ready")
211+
pauseLabel := "app.kubernetes.io/name=pause"
212+
_, err := s.testCluster.K8sHelper.Kubectl("run", "-n", "default", "pause", "--image", "registry.k8s.io/pause:3.10", "-l", pauseLabel)
213+
s.Require().NoError(err, "Failed to create pause pod.")
214+
busyboxLabel := "app.kubernetes.io/name=busybox"
215+
_, err = s.testCluster.K8sHelper.Kubectl("run", "-n", "default", "busybox", "--image", "registry.k8s.io/e2e-test-images/busybox:1.36.1-1", "-l", busyboxLabel, "--command", "--", "sleep", "3600")
216+
s.Require().NoError(err, "Failed to create busybox pod.")
217+
218+
s.True(s.testCluster.K8sHelper.IsPodReady(pauseLabel, "default"), "pause pod is not ready")
219+
s.True(s.testCluster.K8sHelper.IsPodReady(busyboxLabel, "default"), "busybox pod is not ready")
220220
s.auditConfig = auditConfig
221221

222222
// Disable container image resolution to be able to run the k8s resources scan CronJob with a local image.
@@ -479,7 +479,7 @@ func (s *AuditConfigBaseSuite) AssetsNotUnscored(assets []assets.AssetWithScore)
479479
expectedPolicies := defaultK8sNodePolicyMrns
480480
if strings.Contains(asset.Platform.Name, "k8s") {
481481
expectedPolicies = defaultK8sPolicyMrns
482-
} else if strings.Contains(asset.Name, "nginx") || strings.Contains(asset.Name, "redis") || strings.Contains(asset.Name, "k3d") || asset.Platform.Runtime == "docker-image" {
482+
} else if strings.Contains(asset.Name, "pause") || strings.Contains(asset.Name, "busybox") || strings.Contains(asset.Name, "k3d") || asset.Platform.Runtime == "docker-image" {
483483
expectedPolicies = defaultOsPolicyMrns
484484
}
485485
s.ElementsMatchf(expectedPolicies, scoredPolicies, "Scored policies for asset %s should be the default k8s policies", asset.Name)

0 commit comments

Comments
 (0)