@@ -98,13 +98,17 @@ func TestGitAuditSimpleJson(t *testing.T) {
9898 )
9999}
100100
101+ func getDummyGitRepoUrl () string {
102+ return fmt .Sprintf ("https://github.com/jfrog-%s/dummy-repo-url-%s.git" , * securityTests .CiRunId , securityTests .GetUniqueSuffix ())
103+ }
104+
101105func TestGitAuditViolationsWithIgnoreRule (t * testing.T ) {
102106 xrayVersion , xscVersion , testCleanUp := integration .InitGitTest (t , services .MinXrayVersionGitRepoKey )
103107 defer testCleanUp ()
104108
105109 projectPath := filepath .Join (filepath .FromSlash (securityTests .GetTestResourcesPath ()), "git" , "projects" , "issues" )
106110 // Tests are running in parallel for multiple OSes and environments, so we need to generate a unique repo clone URL to avoid conflicts.
107- dummyCloneUrl := fmt . Sprintf ( "https://github.com/jfrog-%s/dummy-repo-url-%s.git" , * securityTests . CiRunId , securityTests . GetUniqueSuffix () )
111+ dummyCloneUrl := getDummyGitRepoUrl ( )
108112
109113 // Create policy and watch for the git repo so we will also get violations (unknown = all vulnerabilities will be reported as violations)
110114 policyName , cleanUpPolicy := securityTestUtils .CreateTestSecurityPolicy (t , "git-repo-ignore-rule-policy" , utils .Unknown , true , false )
@@ -189,6 +193,8 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
189193 defer testCleanUp ()
190194
191195 projectPath := filepath .Join (filepath .FromSlash (securityTests .GetTestResourcesPath ()), "git" , "projects" , "issues" )
196+ // Tests are running in parallel for multiple OSes and environments, so we need to generate a unique repo clone URL to avoid conflicts.
197+ dummyCloneUrl := getDummyGitRepoUrl ()
192198
193199 // Create policy and watch for the git repo so we will also get violations - This watch DO NOT skip not-applicable results
194200 var firstPolicyCleaned , firstWatchCleaned bool
@@ -198,7 +204,7 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
198204 cleanUpPolicy ()
199205 }
200206 }()
201- watchName , cleanUpWatch := securityTestUtils .CreateWatchForTests (t , policyName , "without-skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (validations . TestMockGitInfo . Source . GitRepoHttpsCloneUrl ))
207+ watchName , cleanUpWatch := securityTestUtils .CreateWatchForTests (t , policyName , "without-skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (dummyCloneUrl ))
202208 defer func () {
203209 if ! firstWatchCleaned {
204210 cleanUpWatch ()
@@ -207,7 +213,10 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
207213
208214 // Run the git audit command and verify violations are reported to the platform.
209215 createTestProjectRunGitAuditAndValidate (t , projectPath ,
210- gitAuditCommandTestParams {auditCommandTestParams : auditCommandTestParams {Format : format .SimpleJson , Watches : []string {watchName }, DisableFailOnFailedBuildFlag : true }},
216+ gitAuditCommandTestParams {
217+ auditCommandTestParams : auditCommandTestParams {Format : format .SimpleJson , Watches : []string {watchName }, DisableFailOnFailedBuildFlag : true },
218+ CustomRepoCloneUrl : dummyCloneUrl ,
219+ },
211220 xrayVersion , xscVersion , "" ,
212221 validations.ValidationParams {
213222 Violations : & validations.ViolationCount {
@@ -227,12 +236,15 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
227236 // Create policy and watch for the git repo so we will also get violations - This watch SKIP not-applicable results
228237 skipPolicyName , skipCleanUpPolicy := securityTestUtils .CreateTestSecurityPolicy (t , "skip-non-applicable-policy" , utils .Low , false , true )
229238 defer skipCleanUpPolicy ()
230- skipWatchName , skipCleanUpWatch := securityTestUtils .CreateWatchForTests (t , skipPolicyName , "skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (validations . TestMockGitInfo . Source . GitRepoHttpsCloneUrl ))
239+ skipWatchName , skipCleanUpWatch := securityTestUtils .CreateWatchForTests (t , skipPolicyName , "skip-not-applicable-watch" , xscutils .GetGitRepoUrlKey (dummyCloneUrl ))
231240 defer skipCleanUpWatch ()
232241
233242 // Run the audit command with git repo and verify violations are reported to the platform and not applicable issues are skipped.
234243 createTestProjectRunGitAuditAndValidate (t , projectPath ,
235- gitAuditCommandTestParams {auditCommandTestParams : auditCommandTestParams {Format : format .SimpleJson , Watches : []string {skipWatchName }, DisableFailOnFailedBuildFlag : true }},
244+ gitAuditCommandTestParams {
245+ auditCommandTestParams : auditCommandTestParams {Format : format .SimpleJson , Watches : []string {skipWatchName }, DisableFailOnFailedBuildFlag : true },
246+ CustomRepoCloneUrl : dummyCloneUrl ,
247+ },
236248 xrayVersion , xscVersion , "" ,
237249 validations.ValidationParams {
238250 Violations : & validations.ViolationCount {
0 commit comments