Skip to content

Commit

Permalink
do not retry fetching cicd assets
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Feb 28, 2024
1 parent 2fcaa5a commit a755b11
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/integration/audit_config_base_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,8 @@ func (s *AuditConfigBaseSuite) checkDeployments(auditConfig *mondoov2.MondooAudi
cicdProject, err := s.integration.GetCiCdProject(s.ctx)
s.Require().NoErrorf(err, "Failed to get CICD project")

assets, err := s.WaitUntilCiCdAssetsScored(cicdProject)
s.Require().NoErrorf(err, "Failed to list scored CICD assets")
assets, err := cicdProject.ListAssets(s.ctx)
s.Require().NoErrorf(err, "Failed to list CICD assets")

assetNames := utils.CiCdJobNames(assets)
s.Contains(assetNames, fmt.Sprintf("%s/%s", passingDeployment.Namespace, passingDeployment.Name))
Expand All @@ -892,8 +892,8 @@ func (s *AuditConfigBaseSuite) checkDeployments(auditConfig *mondoov2.MondooAudi
s.NoErrorf(err, "Failed creating a Deployment in permissive mode.")
}

assets, err = s.WaitUntilCiCdAssetsScored(cicdProject)
s.Require().NoErrorf(err, "Failed to list scored CICD assets")
assets, err = cicdProject.ListAssets(s.ctx)
s.Require().NoErrorf(err, "Failed to list CICD assets")

assetNames = utils.CiCdJobNames(assets)
s.Contains(assetNames, fmt.Sprintf("%s/%s", failingDeployment.Namespace, failingDeployment.Name))
Expand All @@ -905,23 +905,23 @@ func (s *AuditConfigBaseSuite) checkDeployments(auditConfig *mondoov2.MondooAudi
s.NoErrorf(s.testCluster.K8sHelper.WaitForResourceDeletion(failingDeployment), "Error waiting for deleteion of failingDeployment")
}

func (s *AuditConfigBaseSuite) WaitUntilCiCdAssetsScored(cicdProject *nexusK8s.CiCdProject) ([]nexusK8s.CiCdJob, error) {
var assets []nexusK8s.CiCdJob
var err error
err = s.testCluster.K8sHelper.ExecuteWithRetries(func() (bool, error) {
assets, err = cicdProject.ListAssets(s.ctx)
if err != nil {
return false, err
}
for _, asset := range assets {
if asset.Grade == "U" {
return false, nil
}
}
return true, nil
})
return assets, err
}
// func (s *AuditConfigBaseSuite) WaitUntilCiCdAssetsScored(cicdProject *nexusK8s.CiCdProject) ([]nexusK8s.CiCdJob, error) {
// var assets []nexusK8s.CiCdJob
// var err error
// err = s.testCluster.K8sHelper.ExecuteWithRetries(func() (bool, error) {
// assets, err = cicdProject.ListAssets(s.ctx)
// if err != nil {
// return false, err
// }
// for _, asset := range assets {
// if asset.Grade == "U" {
// return false, nil
// }
// }
// return true, nil
// })
// return assets, err
// }

func (s *AuditConfigBaseSuite) getWebhookLabelsString() string {
webhookDeploymentLabels := mondooadmission.WebhookDeploymentLabels()
Expand Down

0 comments on commit a755b11

Please sign in to comment.