@@ -36,15 +36,8 @@ import (
3636)
3737
3838const (
39- testMultiDirProjConfigPath = "testdata/config/frogbot-config-multi-dir-test-proj.yml"
40- testMultiDirProjConfigPathNoFail = "testdata/config/frogbot-config-multi-dir-test-proj-no-fail.yml"
41- testProjSubdirConfigPath = "testdata/config/frogbot-config-test-proj-subdir.yml"
42- testCleanProjConfigPath = "testdata/config/frogbot-config-clean-test-proj.yml"
43- testProjConfigPath = "testdata/config/frogbot-config-test-proj.yml"
44- testProjConfigPathNoFail = "testdata/config/frogbot-config-test-proj-no-fail.yml"
45- testJasProjConfigPath = "testdata/config/frogbot-config-jas-diff-proj.yml"
46- testSourceBranchName = "pr"
47- testTargetBranchName = "master"
39+ testSourceBranchName = "pr"
40+ testTargetBranchName = "master"
4841)
4942
5043func TestScanResultsToIssuesCollection (t * testing.T ) {
@@ -209,56 +202,49 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
209202func TestScanPullRequest (t * testing.T ) {
210203 tests := []struct {
211204 testName string
212- configPath string
213205 projectName string
214206 failOnSecurityIssues bool
215207 }{
216208 {
217209 testName : "ScanPullRequest" ,
218- configPath : testProjConfigPath ,
219210 projectName : "test-proj" ,
220211 failOnSecurityIssues : true ,
221212 },
222213 {
223214 testName : "ScanPullRequestNoFail" ,
224- configPath : testProjConfigPathNoFail ,
225215 projectName : "test-proj" ,
226216 failOnSecurityIssues : false ,
227217 },
228218 {
229219 testName : "ScanPullRequestSubdir" ,
230- configPath : testProjSubdirConfigPath ,
231220 projectName : "test-proj-subdir" ,
232221 failOnSecurityIssues : true ,
233222 },
234223 {
235224 testName : "ScanPullRequestNoIssues" ,
236- configPath : testCleanProjConfigPath ,
237225 projectName : "clean-test-proj" ,
238226 failOnSecurityIssues : false ,
239227 },
240228 {
241229 testName : "ScanPullRequestMultiWorkDir" ,
242- configPath : testMultiDirProjConfigPathNoFail ,
243230 projectName : "multi-dir-test-proj" ,
244231 failOnSecurityIssues : false ,
245232 },
246233 {
247234 testName : "ScanPullRequestMultiWorkDirNoFail" ,
248- configPath : testMultiDirProjConfigPath ,
249235 projectName : "multi-dir-test-proj" ,
250236 failOnSecurityIssues : true ,
251237 },
252238 }
253239 for _ , test := range tests {
254240 t .Run (test .testName , func (t * testing.T ) {
255- testScanPullRequest (t , test .configPath , test . projectName , test .failOnSecurityIssues )
241+ testScanPullRequest (t , test .projectName , test .failOnSecurityIssues )
256242 })
257243 }
258244}
259245
260- func testScanPullRequest (t * testing.T , configPath , projectName string , failOnSecurityIssues bool ) {
261- configAggregator , client , cleanUp := preparePullRequestTest (t , projectName , configPath )
246+ func testScanPullRequest (t * testing.T , projectName string , failOnSecurityIssues bool ) {
247+ configAggregator , client , cleanUp := preparePullRequestTest (t , projectName )
262248 defer cleanUp ()
263249
264250 // Run "frogbot scan pull request"
@@ -331,7 +317,7 @@ func TestVerifyGitHubFrogbotEnvironmentOnPrem(t *testing.T) {
331317 assert .NoError (t , err )
332318}
333319
334- func prepareConfigAndClient (t * testing.T , xrayVersion , xscVersion , configPath string , server * httptest.Server , serverParams coreconfig.ServerDetails , gitServerParams GitServerParams ) (utils.RepoAggregator , vcsclient.VcsClient ) {
320+ func prepareConfigAndClient (t * testing.T , xrayVersion , xscVersion string , server * httptest.Server , serverParams coreconfig.ServerDetails , gitServerParams GitServerParams ) (utils.RepoAggregator , vcsclient.VcsClient ) {
335321 gitTestParams := & utils.Git {
336322 GitProvider : vcsutils .GitHub ,
337323 RepoOwner : gitServerParams .RepoOwner ,
@@ -472,13 +458,11 @@ func TestAuditDiffInPullRequest(t *testing.T) {
472458 tests := []struct {
473459 testName string
474460 projectName string
475- configPath string
476461 expectedIssues TestResult
477462 }{
478463 {
479464 testName : "Project with Jas issues (issues added removed and not changed)" ,
480465 projectName : "jas-diff-proj" ,
481- configPath : testJasProjConfigPath ,
482466 expectedIssues : TestResult {
483467 Sca : 4 ,
484468 Sast : 1 ,
@@ -488,7 +472,7 @@ func TestAuditDiffInPullRequest(t *testing.T) {
488472
489473 for _ , test := range tests {
490474 t .Run (test .testName , func (t * testing.T ) {
491- repoConfig , client , cleanUpTest := preparePullRequestTest (t , test .projectName , test . configPath )
475+ repoConfig , client , cleanUpTest := preparePullRequestTest (t , test .projectName )
492476 defer cleanUpTest ()
493477
494478 assert .Len (t , repoConfig , 1 )
@@ -1135,7 +1119,7 @@ func TestFilterOutFailedScansIfAllowPartialResultsEnabled(t *testing.T) {
11351119 }
11361120}
11371121
1138- func preparePullRequestTest (t * testing.T , projectName , configPath string ) (utils.RepoAggregator , vcsclient.VcsClient , func ()) {
1122+ func preparePullRequestTest (t * testing.T , projectName string ) (utils.RepoAggregator , vcsclient.VcsClient , func ()) {
11391123 params , restoreEnv := utils .VerifyEnv (t )
11401124
11411125 xrayVersion , xscVersion , err := xsc .GetJfrogServicesVersion (& params )
@@ -1154,7 +1138,7 @@ func preparePullRequestTest(t *testing.T, projectName, configPath string) (utils
11541138 server := httptest .NewServer (createGitLabHandler (t , gitServerParams ))
11551139
11561140 testDir , cleanUp := utils .CopyTestdataProjectsToTemp (t , "scanpullrequest" )
1157- configAggregator , client := prepareConfigAndClient (t , xrayVersion , xscVersion , configPath , server , params , gitServerParams )
1141+ configAggregator , client := prepareConfigAndClient (t , xrayVersion , xscVersion , server , params , gitServerParams )
11581142
11591143 // Renames test git folder to .git
11601144 currentDir := filepath .Join (testDir , projectName )
0 commit comments