-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The dast test for far operator is moved to a separate file, and it is labeled with additional "dast" label, to be able to run it apart from the rest of the operator tests if needed.
- Loading branch information
Showing
6 changed files
with
75 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package tests | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/openshift-kni/eco-goinfra/pkg/deployment" | ||
"github.com/openshift-kni/eco-goinfra/pkg/reportxml" | ||
|
||
"github.com/openshift-kni/eco-gotests/tests/rhwa/far-operator/internal/farparams" | ||
. "github.com/openshift-kni/eco-gotests/tests/rhwa/internal/rapidast" | ||
. "github.com/openshift-kni/eco-gotests/tests/rhwa/internal/rhwainittools" | ||
"github.com/openshift-kni/eco-gotests/tests/rhwa/internal/rhwaparams" | ||
) | ||
|
||
var _ = Describe( | ||
"FAR Post Deployment tests", | ||
Ordered, | ||
ContinueOnFailure, | ||
Label(farparams.Label), Label("dast"), func() { | ||
BeforeAll(func() { | ||
By("Get FAR deployment object") | ||
farDeployment, err := deployment.Pull( | ||
APIClient, farparams.OperatorDeploymentName, rhwaparams.RhwaOperatorNs) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to get FAR deployment") | ||
|
||
By("Verify FAR deployment is Ready") | ||
Expect(farDeployment.IsReady(rhwaparams.DefaultTimeout)).To(BeTrue(), "FAR deployment is not Ready") | ||
}) | ||
|
||
It("Verify FAR Operator passes trivy scan without vulnerabilities", reportxml.ID("76877"), func() { | ||
|
||
By("Creating rapidast pod") | ||
dastTestPod := PrepareRapidastPod(APIClient) | ||
|
||
output, err := RunRapidastScan(*dastTestPod, rhwaparams.RhwaOperatorNs) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
By("Checking vulnerability scan results") | ||
var parsableStruct DASTReport | ||
err = json.Unmarshal(output.Bytes(), &parsableStruct) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
var vulnerabilityFound = false | ||
for _, resource := range parsableStruct.Resources { | ||
for _, result := range resource.Results { | ||
if result.MisconfSummary.Failures > 0 { | ||
fmt.Printf("%d vulnerability(s) found in %s\n", result.MisconfSummary.Failures, resource.Name) | ||
for _, misconfiguration := range result.Misconfigurations { | ||
fmt.Printf("- %+v\n", misconfiguration) | ||
} | ||
vulnerabilityFound = true | ||
} | ||
} | ||
} | ||
Expect(vulnerabilityFound).NotTo(BeTrue(), "Found vulnerability(s)") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters