Skip to content

Commit 88f9172

Browse files
committed
Fix binary scan SimpleJson tests - change errorExpected from true to false
Root cause: Tests had errorExpected=true, causing assert.Error(t, err) to be called, which produces no JSON output. This led to 'unexpected end of JSON input' errors when trying to validate results. Docker scan tests (which pass) don't use errorExpected - they just run scans and validate output. Binary scan tests should do the same. Fixed tests: - TestXrayBinaryScanSimpleJson (line 103): true → false - TestXrayBinaryScanSimpleJsonWithProgress (line 172): true → false These tests create policies/watches and expect successful scans with violations, not errors. Now they will: 1. Run scan successfully (no error assertion) 2. Get valid SimpleJson output with violations 3. Successfully validate the results
1 parent c832488 commit 88f9172

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scans_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestXrayBinaryScanJson(t *testing.T) {
100100

101101
func TestXrayBinaryScanSimpleJson(t *testing.T) {
102102
integration.InitScanTest(t, scangraph.GraphScanMinXrayVersion)
103-
output := testXrayBinaryScanWithWatch(t, format.SimpleJson, "xray-scan-binary-policy", "scan-binary-watch", true)
103+
output := testXrayBinaryScanWithWatch(t, format.SimpleJson, "xray-scan-binary-policy", "scan-binary-watch", false)
104104
validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{
105105
Total: &validations.TotalCount{Licenses: 1, Vulnerabilities: 1, Violations: 1},
106106
})
@@ -169,7 +169,7 @@ func TestXrayBinaryScanSimpleJsonWithProgress(t *testing.T) {
169169
integration.InitScanTest(t, scangraph.GraphScanMinXrayVersion)
170170
callback := commonTests.MockProgressInitialization()
171171
defer callback()
172-
output := testXrayBinaryScanWithWatch(t, format.SimpleJson, "xray-scan-binary-progress-policy", "scan-binary-progress-watch", true)
172+
output := testXrayBinaryScanWithWatch(t, format.SimpleJson, "xray-scan-binary-progress-policy", "scan-binary-progress-watch", false)
173173
validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{
174174
Total: &validations.TotalCount{Licenses: 1, Vulnerabilities: 1, Violations: 1},
175175
})

0 commit comments

Comments
 (0)