Skip to content

Commit 8ef541e

Browse files
committed
Remove all config yml file support and references
- Deleted .frogbot/frogbot-config.yml from repo root - Deleted testdata/config/ directory with all config test files - Deleted .frogbot directories from scanrepository test subdirectories - Removed configPath parameters from test functions - Removed config file validation from schema tests - Removed unused config file path constants - Cleaned up unused imports Config files are no longer used - all configuration now comes from environment variables only
1 parent 555d703 commit 8ef541e

22 files changed

+14
-301
lines changed

.frogbot/frogbot-config.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

scanpullrequest/scanpullrequest_test.go

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,8 @@ import (
3636
)
3737

3838
const (
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

5043
func TestScanResultsToIssuesCollection(t *testing.T) {
@@ -209,56 +202,49 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
209202
func 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)

scanrepository/scanmultiplerepositories_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"net/http"
99
"net/http/httptest"
1010
"os"
11-
"path/filepath"
1211
"strings"
1312
"testing"
1413

@@ -21,7 +20,6 @@ import (
2120
"github.com/stretchr/testify/assert"
2221
)
2322

24-
var testScanMultipleRepositoriesConfigPath = filepath.Join("..", "testdata", "config", "frogbot-config-scan-multiple-repositories.yml")
2523
var testRepositories = []string{"pip-repo", "npm-repo", "mvn-repo"}
2624

2725
func TestScanAndFixRepos(t *testing.T) {

scanrepository/scanrepository_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ var testPackagesData = []struct {
8484
func TestScanRepositoryCmd_Run(t *testing.T) {
8585
tests := []struct {
8686
testName string
87-
configPath string
8887
expectedPackagesInBranch map[string][]string
8988
expectedVersionUpdatesInBranch map[string][]string
9089
expectedMissingFilesInBranch map[string][]string
@@ -106,7 +105,6 @@ func TestScanRepositoryCmd_Run(t *testing.T) {
106105
expectedMissingFilesInBranch: map[string][]string{"frogbot-update-npm-dependencies-master": {"npm1/package-lock.json", "npm2/package-lock.json"}},
107106
packageDescriptorPaths: []string{"npm1/package.json", "npm2/package.json"},
108107
aggregateFixes: true,
109-
configPath: "../testdata/scanrepository/cmd/aggregate-multi-dir/.frogbot/frogbot-config.yml",
110108
},
111109
{
112110
testName: "aggregate-multi-project",
@@ -115,7 +113,6 @@ func TestScanRepositoryCmd_Run(t *testing.T) {
115113
expectedMissingFilesInBranch: map[string][]string{"frogbot-update-npm-dependencies-master": {"npm/package-lock.json"}},
116114
packageDescriptorPaths: []string{"npm/package.json", "pip/requirements.txt"},
117115
aggregateFixes: true,
118-
configPath: "../testdata/scanrepository/cmd/aggregate-multi-project/.frogbot/frogbot-config.yml",
119116
},
120117
{
121118
testName: "aggregate-no-vul",
@@ -148,7 +145,6 @@ func TestScanRepositoryCmd_Run(t *testing.T) {
148145
expectedVersionUpdatesInBranch: map[string][]string{"frogbot-update-npm-dependencies-master": {"1.2.6", "0.8.4"}},
149146
packageDescriptorPaths: []string{"package.json", "inner-project/package.json"},
150147
aggregateFixes: true,
151-
configPath: "../testdata/scanrepository/cmd/partial-results-enabled/.frogbot/frogbot-config.yml",
152148
allowPartialResults: true,
153149
},
154150
}

schema/schemas_test.go

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,13 @@ const (
2222
)
2323

2424
func TestFrogbotSchema(t *testing.T) {
25-
// Load frogbot schema
26-
schema, err := os.ReadFile("frogbot-schema.json")
27-
assert.NoError(t, err)
28-
schemaLoader := gojsonschema.NewBytesLoader(schema)
29-
30-
// Config files are no longer used - skip repository config validation
31-
32-
// Validate all frogbot configs in commands/testdata/config
33-
validateYamlsInDirectory(t, filepath.Join("..", "testdata", "config"), schemaLoader)
25+
// Config files are no longer used - schema validation tests are skipped
26+
t.Skip("Config files are no longer used")
3427
}
3528

3629
func TestBadFrogbotSchemas(t *testing.T) {
37-
// Load frogbot schema
38-
schema, err := os.ReadFile("frogbot-schema.json")
39-
assert.NoError(t, err)
40-
schemaLoader := gojsonschema.NewBytesLoader(schema)
41-
42-
// Validate all bad frogbot configs in schema/testdata/
43-
testCases := []struct {
44-
testName string
45-
errorString string
46-
}{
47-
{"additional-prop", "Additional property additionalProp is not allowed"},
48-
{"no-array", "Expected: array, given: object"},
49-
{"no-git", "git is required"},
50-
{"no-repo", "repoName is required"},
51-
{"empty-repo", "Expected: string, given: null"},
52-
}
53-
for _, testCase := range testCases {
54-
validateYamlSchema(t, schemaLoader, filepath.Join("testdata", testCase.testName+".yml"), testCase.errorString)
55-
}
30+
// Config files are no longer used - schema validation tests are skipped
31+
t.Skip("Config files are no longer used")
5632
}
5733

5834
func TestJFrogPipelinesTemplates(t *testing.T) {

testdata/config/frogbot-config-clean-test-proj.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

testdata/config/frogbot-config-empty-scan.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

testdata/config/frogbot-config-jas-diff-proj.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

testdata/config/frogbot-config-multi-dir-test-proj-no-fail.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

testdata/config/frogbot-config-multi-dir-test-proj.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)