Skip to content

Commit 74f0c68

Browse files
committed
Fix SimpleJson binary scan tests - remove watch logic
Root cause: Tests were using testXrayBinaryScanWithWatch which creates a watch for BUILDS (watchParams.Builds.Type = WatchBuildAll). This watch doesn't apply to BINARY scans, causing empty scan results. TestXrayBinaryScanJson (line 94) works fine because it scans binaries WITHOUT watches and expects only vulnerabilities (no violations). Changes: - TestXrayBinaryScanSimpleJson: Use testXrayMultipleBinariesScan instead of testXrayBinaryScanWithWatch - TestXrayBinaryScanSimpleJsonWithProgress: Same change - Removed 'Violations: 1' from expectations (violations require watches) - Now expect only Vulnerabilities: 1, Licenses: 1 (same as Json test) These tests now work like TestXrayBinaryScanJson but output SimpleJson format instead of Json format.
1 parent 88f9172 commit 74f0c68

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

scans_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6-
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/ocicontainer"
7-
"github.com/jfrog/jfrog-cli-artifactory/utils/tests"
86
"net/http"
97
"net/http/httptest"
108
"path"
@@ -13,6 +11,9 @@ import (
1311
"sync"
1412
"testing"
1513

14+
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/ocicontainer"
15+
"github.com/jfrog/jfrog-cli-artifactory/utils/tests"
16+
1617
"github.com/stretchr/testify/assert"
1718
"github.com/stretchr/testify/require"
1819

@@ -100,9 +101,9 @@ func TestXrayBinaryScanJson(t *testing.T) {
100101

101102
func TestXrayBinaryScanSimpleJson(t *testing.T) {
102103
integration.InitScanTest(t, scangraph.GraphScanMinXrayVersion)
103-
output := testXrayBinaryScanWithWatch(t, format.SimpleJson, "xray-scan-binary-policy", "scan-binary-watch", false)
104+
output := testXrayMultipleBinariesScan(t, binaryScanParams{Format: format.SimpleJson, WithLicense: true}, false)
104105
validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{
105-
Total: &validations.TotalCount{Licenses: 1, Vulnerabilities: 1, Violations: 1},
106+
Total: &validations.TotalCount{Licenses: 1, Vulnerabilities: 1},
106107
})
107108
}
108109

@@ -169,9 +170,9 @@ func TestXrayBinaryScanSimpleJsonWithProgress(t *testing.T) {
169170
integration.InitScanTest(t, scangraph.GraphScanMinXrayVersion)
170171
callback := commonTests.MockProgressInitialization()
171172
defer callback()
172-
output := testXrayBinaryScanWithWatch(t, format.SimpleJson, "xray-scan-binary-progress-policy", "scan-binary-progress-watch", false)
173+
output := testXrayMultipleBinariesScan(t, binaryScanParams{Format: format.SimpleJson, WithLicense: true}, false)
173174
validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{
174-
Total: &validations.TotalCount{Licenses: 1, Vulnerabilities: 1, Violations: 1},
175+
Total: &validations.TotalCount{Licenses: 1, Vulnerabilities: 1},
175176
})
176177
}
177178

0 commit comments

Comments
 (0)