@@ -7,13 +7,14 @@ import (
77 "github.com/stretchr/testify/assert"
88
99 "github.com/jfrog/jfrog-cli-core/v2/common/format"
10+ "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
1011 "github.com/jfrog/jfrog-cli-security/commands/git/contributors"
1112 securityTests "github.com/jfrog/jfrog-cli-security/tests"
1213 securityTestUtils "github.com/jfrog/jfrog-cli-security/tests/utils"
1314 "github.com/jfrog/jfrog-cli-security/tests/utils/integration"
15+ "github.com/jfrog/jfrog-cli-security/tests/validations"
1416 securityUtils "github.com/jfrog/jfrog-cli-security/utils"
1517 "github.com/jfrog/jfrog-cli-security/utils/results"
16- "github.com/jfrog/jfrog-cli-security/utils/validations"
1718 "github.com/jfrog/jfrog-cli-security/utils/xray/scangraph"
1819 "github.com/jfrog/jfrog-client-go/utils/tests"
1920 "github.com/jfrog/jfrog-client-go/xray/services"
@@ -87,6 +88,9 @@ func TestGitAuditSimpleJson(t *testing.T) {
8788}
8889
8990func TestGitAuditViolationsWithIgnoreRule (t * testing.T ) {
91+ if ! coreutils .IsLinux () {
92+ t .Skip ("Skipping test. This test only runs on Linux to avoid flaky tests when running in parallel tests." )
93+ }
9094 xrayVersion , xscVersion , testCleanUp := integration .InitGitTest (t , services .MinXrayVersionGitRepoKey )
9195 defer testCleanUp ()
9296
@@ -95,7 +99,7 @@ func TestGitAuditViolationsWithIgnoreRule(t *testing.T) {
9599 // Create policy and watch for the git repo so we will also get violations (unknown = all vulnerabilities will be reported as violations)
96100 policyName , cleanUpPolicy := securityTestUtils .CreateTestSecurityPolicy (t , "git-repo-ignore-rule-policy" , utils .Unknown , true , false )
97101 defer cleanUpPolicy ()
98- watchName , cleanUpWatch := securityTestUtils .CreateWatchForTests (t , policyName , "git-repo-ignore-rule-watch" , xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .GitRepoHttpsCloneUrl ))
102+ watchName , cleanUpWatch := securityTestUtils .CreateWatchForTests (t , policyName , "git-repo-ignore-rule-watch" , xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .Source . GitRepoHttpsCloneUrl ))
99103 defer cleanUpWatch ()
100104
101105 // Run the audit command with git repo and verify violations are reported to the platform.
@@ -111,19 +115,19 @@ func TestGitAuditViolationsWithIgnoreRule(t *testing.T) {
111115
112116 // Create an ignore rules for the git repo
113117 cleanUpCveIgnoreRule := securityTestUtils .CreateTestIgnoreRules (t , "security cli tests - Sca ignore rule" , utils.IgnoreFilters {
114- GitRepositories : []string {xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .GitRepoHttpsCloneUrl )},
118+ GitRepositories : []string {xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .Source . GitRepoHttpsCloneUrl )},
115119 CVEs : []string {"any" }, Licenses : []string {"any" },
116120 Watches : []string {watchName },
117121 })
118122 defer cleanUpCveIgnoreRule ()
119123 cleanUpExposureIgnoreRule := securityTestUtils .CreateTestIgnoreRules (t , "security cli tests - Exposure ignore rule" , utils.IgnoreFilters {
120- GitRepositories : []string {xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .GitRepoHttpsCloneUrl )},
124+ GitRepositories : []string {xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .Source . GitRepoHttpsCloneUrl )},
121125 Exposures : & utils.ExposuresFilterName {Categories : []utils.ExposureType {utils .SecretExposureType , utils .IacExposureType }},
122126 Watches : []string {watchName },
123127 })
124128 defer cleanUpExposureIgnoreRule ()
125129 cleanSastUpIgnoreRule := securityTestUtils .CreateTestIgnoreRules (t , "security cli tests - Sast ignore rule" , utils.IgnoreFilters {
126- GitRepositories : []string {xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .GitRepoHttpsCloneUrl )},
130+ GitRepositories : []string {xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .Source . GitRepoHttpsCloneUrl )},
127131 Sast : & utils.SastFilterName {Rule : []string {"any" }},
128132 Watches : []string {watchName },
129133 })
@@ -178,7 +182,7 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
178182 cleanUpPolicy ()
179183 }
180184 }()
181- watchName , cleanUpWatch := securityTestUtils .CreateWatchForTests (t , policyName , "without-skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .GitRepoHttpsCloneUrl ))
185+ watchName , cleanUpWatch := securityTestUtils .CreateWatchForTests (t , policyName , "without-skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .Source . GitRepoHttpsCloneUrl ))
182186 defer func () {
183187 if ! firstWatchCleaned {
184188 cleanUpWatch ()
@@ -207,7 +211,7 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
207211 // Create policy and watch for the git repo so we will also get violations - This watch SKIP not-applicable results
208212 skipPolicyName , skipCleanUpPolicy := securityTestUtils .CreateTestSecurityPolicy (t , "skip-non-applicable-policy" , utils .Low , false , true )
209213 defer skipCleanUpPolicy ()
210- skipWatchName , skipCleanUpWatch := securityTestUtils .CreateWatchForTests (t , skipPolicyName , "skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .GitRepoHttpsCloneUrl ))
214+ skipWatchName , skipCleanUpWatch := securityTestUtils .CreateWatchForTests (t , skipPolicyName , "skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (validations .TestMockGitInfo .Source . GitRepoHttpsCloneUrl ))
211215 defer skipCleanUpWatch ()
212216
213217 // Run the audit command with git repo and verify violations are reported to the platform and not applicable issues are skipped.
0 commit comments