Skip to content

Commit

Permalink
fix: exclude services from assets score check in the integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
slntopp committed Jun 20, 2024
1 parent 0ff41c3 commit 1340f0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion tests/integration/audit_config_base_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,15 @@ func (s *AuditConfigBaseSuite) testMondooAuditConfigKubernetesResources(auditCon
assetsExceptCluster := utils.ExcludeClusterAsset(assets)

// TODO: this number should exclude services and the cluster asset
s.Equalf(len(assets)-4, len(assetsExceptCluster), "Cluster asset was sent upstream.")
srvs := &corev1.ServiceList{}
err = s.testCluster.K8sHelper.ExecuteWithRetries(func() (bool, error) {
if err := s.testCluster.K8sHelper.Clientset.List(s.ctx, srvs); err != nil {
return false, nil
}
return true, nil
})
s.NoError(err, "Failed to list Kubernetes Services")
s.Equalf(len(assets)-1-len(srvs.Items), len(assetsExceptCluster), "Cluster asset was sent upstream.")

assetNames := utils.AssetNames(assetsExceptCluster)
s.ElementsMatchf(workloadNames, assetNames, "Workloads were not sent upstream.")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/audit_config_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (s *AuditConfigCustomNamespaceSuite) TearDownSuite() {
s.AuditConfigBaseSuite.TearDownSuite()
}

func (s *AuditConfigCustomNamespaceSuite) TestReconcile_KubernetesResources2() {
func (s *AuditConfigCustomNamespaceSuite) TestReconcile_KubernetesResources() {
auditConfig := utils.DefaultAuditConfigMinimal(s.ns.Name, true, false, false, false)
auditConfig.Spec.Scanner.ServiceAccountName = s.sa.Name
s.testMondooAuditConfigKubernetesResources(auditConfig)
Expand Down

0 comments on commit 1340f0e

Please sign in to comment.