Skip to content

Commit

Permalink
Merge pull request #5585 from JAORMX/display-rem
Browse files Browse the repository at this point in the history
ocp4/e2e: display remediations for second scan
  • Loading branch information
JAORMX committed Apr 14, 2020
2 parents 09161b9 + a544cc0 commit a433fbd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/ocp4e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestE2e(t *testing.T) {
// Create suite and auto-apply remediations
suite := ctx.createComplianceSuiteForProfile("1", true)
ctx.waitForComplianceSuite(suite)
numberOfRemediationsInit = ctx.getRemediationsForSuite(suite)
numberOfRemediationsInit = ctx.getRemediationsForSuite(suite, false)
})

t.Run("Wait for Remediations to apply", func(t *testing.T) {
Expand All @@ -48,7 +48,7 @@ func TestE2e(t *testing.T) {
// Create suite and auto-apply remediations
suite := ctx.createComplianceSuiteForProfile("2", false)
ctx.waitForComplianceSuite(suite)
numberOfRemediationsEnd = ctx.getRemediationsForSuite(suite)
numberOfRemediationsEnd = ctx.getRemediationsForSuite(suite, true)
})

t.Run("We should have less remediations to apply", func(t *testing.T) {
Expand Down
10 changes: 9 additions & 1 deletion tests/ocp4e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func (ctx *e2econtext) waitForNodesToBeReady() {
}
}

func (ctx *e2econtext) getRemediationsForSuite(s *cmpv1alpha1.ComplianceSuite) int {
func (ctx *e2econtext) getRemediationsForSuite(s *cmpv1alpha1.ComplianceSuite, display bool) int {
remList := &cmpv1alpha1.ComplianceRemediationList{}
labelSelector, _ := labels.Parse(cmpv1alpha1.SuiteLabel + "=" + s.Name)
opts := &client.ListOptions{
Expand All @@ -365,6 +365,14 @@ func (ctx *e2econtext) getRemediationsForSuite(s *cmpv1alpha1.ComplianceSuite) i
if err != nil {
ctx.t.Fatalf("Couldn't get remediation list")
}
if display {
if len(remList.Items) > 0 {
ctx.t.Logf("Remediations from ComplianceSuite: %s", s.Name)
}
for _, rem := range remList.Items {
ctx.t.Logf("- %s", rem.Name)
}
}
return len(remList.Items)
}

Expand Down

0 comments on commit a433fbd

Please sign in to comment.