Skip to content

Commit

Permalink
Refactor error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Miaha Cybersec <[email protected]>
  • Loading branch information
Miaha Cybersec authored and Miaha Cybersec committed Jul 25, 2024
1 parent 21bab9c commit e71f29e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions integration/patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,18 @@ func TestPatch(t *testing.T) {
t.Log("patching image")
patch(t, ref, tagPatched, dir, img.IgnoreErrors, reportFile)

if reportFile {
switch {
case strings.Contains(img.Image, "oracle"):
t.Log("Oracle image detected. Skipping Trivy scan.")
case reportFile:
t.Log("scanning patched image")
scanner().
withIgnoreFile(ignoreFile).
withSkipDBUpdate().
// here we want a non-zero exit code because we are expecting no vulnerabilities.
withExitCode(1).
scan(t, patchedRef, img.IgnoreErrors)
} else if strings.Contains(img.Image, "oracle") {
t.Log("Oracle image detected. Skipping Trivy scan.")
} else {
default:
t.Log("scanning patched image")
scanner().
withIgnoreFile(ignoreFile).
Expand All @@ -114,7 +115,7 @@ func TestPatch(t *testing.T) {
}

// currently validation is only present when patching with a scan report
if reportFile {
if reportFile && !strings.Contains(img.Image, "oracle") {
t.Log("verifying the vex output")
validVEXJSON(t, dir)
}
Expand Down

0 comments on commit e71f29e

Please sign in to comment.