Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit e92e093

Browse files
authored
Merge pull request #131 from docker/update-TestScanSucceedWithDockerHub-limits
Check error code of the TestScanSucceedWithDockerHub to verify the ri…
2 parents f67a78b + 7c2660b commit e92e093

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

e2e/scan_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,15 @@ func TestScanSucceedWithDockerHub(t *testing.T) {
9393
patchConfig(t, configDir, os.Getenv("E2E_HUB_URL"), os.Getenv("E2E_HUB_USERNAME"), os.Getenv("E2E_HUB_TOKEN"))
9494

9595
cmd.Command = dockerCli.Command("scan", ImageWithVulnerabilities)
96-
output := icmd.RunCmd(cmd).Assert(t, icmd.Expected{ExitCode: 1}).Combined()
97-
assert.Assert(t, cmp.Regexp("found .* vulnerabilities", output), output)
96+
result := icmd.RunCmd(cmd)
97+
if result.ExitCode == 1 {
98+
assert.Assert(t, cmp.Regexp("found .* vulnerabilities", result.Combined()), result.Combined())
99+
} else {
100+
// We reach the monthly limits of 10 free scans
101+
assert.Assert(t, result.ExitCode == 2)
102+
assert.Assert(t, strings.Contains(result.Combined(), "You have reached the scan limit of 10 monthly scans without authentication."), result.Combined())
103+
}
104+
98105
}
99106

100107
func TestScanWithSnyk(t *testing.T) {

0 commit comments

Comments
 (0)