@@ -5,7 +5,6 @@ package integration
55
66import (
77 "context"
8- "fmt"
98 "strings"
109 "time"
1110
@@ -25,7 +24,6 @@ import (
2524 "go.mondoo.com/mondoo-operator/controllers/k8s_scan"
2625 "go.mondoo.com/mondoo-operator/controllers/nodes"
2726 "go.mondoo.com/mondoo-operator/controllers/resource_watcher"
28- "go.mondoo.com/mondoo-operator/pkg/utils/k8s"
2927 "go.mondoo.com/mondoo-operator/pkg/utils/logger"
3028 "go.mondoo.com/mondoo-operator/pkg/version"
3129 "go.mondoo.com/mondoo-operator/tests/framework/installer"
@@ -159,7 +157,7 @@ func (s *AuditConfigBaseSuite) testMondooAuditConfigKubernetesResources(auditCon
159157 s .testCluster .K8sHelper .WaitUntilCronJobsSuccessful (utils .LabelsToLabelSelector (cronJobLabels ), auditConfig .Namespace ),
160158 "Kubernetes resources scan CronJob did not run successfully." )
161159
162- err = s .testCluster .K8sHelper .CheckForPodInStatus (& auditConfig , "client-k8s-scan" )
160+ err = s .testCluster .K8sHelper .CheckForPodInStatus (& auditConfig , k8s_scan . CronJobName ( auditConfig . Name ) )
163161 s .NoErrorf (err , "Couldn't find k8s scan pod in Podlist of the MondooAuditConfig Status" )
164162
165163 err = s .testCluster .K8sHelper .CheckForReconciledOperatorVersion (& auditConfig , version .Version )
@@ -259,7 +257,7 @@ func (s *AuditConfigBaseSuite) testMondooAuditConfigContainers(auditConfig mondo
259257 s .testCluster .K8sHelper .WaitUntilCronJobsSuccessful (utils .LabelsToLabelSelector (cronJobLabels ), auditConfig .Namespace ),
260258 "Kubernetes container image scan CronJob did not run successfully." )
261259
262- err = s .testCluster .K8sHelper .CheckForPodInStatus (& auditConfig , "client-containers-scan" )
260+ err = s .testCluster .K8sHelper .CheckForPodInStatus (& auditConfig , container_image . CronJobName ( auditConfig . Name ) )
263261 s .NoErrorf (err , "Couldn't find container image scan pod in Podlist of the MondooAuditConfig Status" )
264262
265263 err = s .testCluster .K8sHelper .CheckForReconciledOperatorVersion (& auditConfig , version .Version )
@@ -352,10 +350,9 @@ func (s *AuditConfigBaseSuite) testMondooAuditConfigNodesCronjobs(auditConfig mo
352350 selector := utils .LabelsToLabelSelector (cronJobLabels )
353351 s .True (s .testCluster .K8sHelper .WaitUntilCronJobsSuccessful (selector , auditConfig .Namespace ), "Not all CronJobs have run successfully." )
354352
355- base := fmt .Sprintf ("%s%s" , auditConfig .Name , nodes .CronJobNameBase )
356353 for _ , node := range nodeList .Items {
357- nodeIdentifier := nodes .NodeNameOrHash ( k8s . ResourceNameMaxLength - len ( base ) , node .Name )
358- err := s .testCluster .K8sHelper .CheckForPodInStatus (& auditConfig , "client-node-" + nodeIdentifier )
354+ cronJobName := nodes .CronJobName ( auditConfig . Name , node .Name )
355+ err := s .testCluster .K8sHelper .CheckForPodInStatus (& auditConfig , cronJobName )
359356 s .NoErrorf (err , "Couldn't find NodeScan Pod for node " + node .Name + " in Podlist of the MondooAuditConfig Status" )
360357 }
361358
0 commit comments