From 15719c2c4f18952d18bde1ff41e75b380cc98297 Mon Sep 17 00:00:00 2001 From: Cody Rose Date: Fri, 14 Jun 2024 14:30:18 -0400 Subject: [PATCH] Fix integration tests (#2970) The recent engine changes (#2887) broke some integration tests. This PR fixes them. I also fixed an unrelated linter issue. --- pkg/detectors/multi_part_credential_provider_test.go | 1 + pkg/engine/filesystem_integration_test.go | 10 ++++++---- pkg/engine/gitlab_integration_test.go | 10 ++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pkg/detectors/multi_part_credential_provider_test.go b/pkg/detectors/multi_part_credential_provider_test.go index a27ce141b..ddc9cb045 100644 --- a/pkg/detectors/multi_part_credential_provider_test.go +++ b/pkg/detectors/multi_part_credential_provider_test.go @@ -25,6 +25,7 @@ func TestMultiPartCredentialProviders(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/pkg/engine/filesystem_integration_test.go b/pkg/engine/filesystem_integration_test.go index f458c14c9..b95b31191 100644 --- a/pkg/engine/filesystem_integration_test.go +++ b/pkg/engine/filesystem_integration_test.go @@ -61,11 +61,13 @@ func TestFilesystem(t *testing.T) { // Run the scan. ctx := context.Background() - e, err := Start(ctx, - WithDetectors(DefaultDetectors()...), - WithVerify(false), - ) + e, err := NewEngine(ctx, &Config{ + Detectors: DefaultDetectors(), + SourceManager: sources.NewManager(), + Verify: false, + }) assert.NoError(t, err) + e.Start(ctx) err = e.ScanFileSystem(ctx, sources.FilesystemConfig{ Paths: []string{rootDir}, ExcludePathsFile: filepath.Join(configDir, "exclude"), diff --git a/pkg/engine/gitlab_integration_test.go b/pkg/engine/gitlab_integration_test.go index dbd45ea43..b2b026edd 100644 --- a/pkg/engine/gitlab_integration_test.go +++ b/pkg/engine/gitlab_integration_test.go @@ -16,11 +16,13 @@ import ( func TestGitLab(t *testing.T) { // Run the scan. ctx := context.Background() - e, err := Start(ctx, - WithDetectors(DefaultDetectors()...), - WithVerify(false), - ) + e, err := NewEngine(ctx, &Config{ + Detectors: DefaultDetectors(), + SourceManager: sources.NewManager(), + Verify: false, + }) assert.NoError(t, err) + e.Start(ctx) secret, err := common.GetTestSecret(ctx) if err != nil {