From b473ce74e32ec15bdab035deba70a79bc9653f67 Mon Sep 17 00:00:00 2001 From: Alvaro Cabanas Date: Fri, 16 Feb 2024 16:40:27 +0100 Subject: [PATCH] Fix Linting issues (#1813) --- pkg/integrations/legacy/runner.go | 2 +- pkg/integrations/v4/manager_test.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/integrations/legacy/runner.go b/pkg/integrations/legacy/runner.go index d9c82af1b..9e3ca69dc 100644 --- a/pkg/integrations/legacy/runner.go +++ b/pkg/integrations/legacy/runner.go @@ -375,7 +375,7 @@ func (ep *externalPlugin) detailedLogFields() logrus.Fields { func ArgumentsToEnvVars(verbose int, tempDir string, arguments map[string]string) map[string]string { envVars := make(map[string]string) envVars["VERBOSE"] = fmt.Sprintf("%v", verbose) - envVars["TEMP_DIR"] = fmt.Sprintf("%s", tempDir) + envVars["TEMP_DIR"] = tempDir // Pass the integration arguments as environment variables to the command for k, v := range arguments { diff --git a/pkg/integrations/v4/manager_test.go b/pkg/integrations/v4/manager_test.go index ccb4d3f4e..e9a6444f6 100644 --- a/pkg/integrations/v4/manager_test.go +++ b/pkg/integrations/v4/manager_test.go @@ -988,12 +988,14 @@ func TestManager_StartWithVerboseFalse(t *testing.T) { }) } +//nolint:paralleltest func TestManager_StartWithTempDir(t *testing.T) { // GIVEN a configuration file for an OHI with feature in it dir, err := tempFiles(map[string]string{ "foo.yaml": getV4VerboseCheckYAML(t), }) require.NoError(t, err) + defer removeTempFiles(t, dir) // AND an integrations manager and with feature enabled within agent config @@ -1006,6 +1008,7 @@ func TestManager_StartWithTempDir(t *testing.T) { // AND the manager starts ctx, cancel := context.WithCancel(context.Background()) defer cancel() + go mgr.Start(ctx) d := getEmittedData(t, emitter, "verbose-check") @@ -1018,25 +1021,31 @@ func TestManager_StartWithTempDir(t *testing.T) { }) } +//nolint:paralleltest func TestManager_StartWithoutTempDir(t *testing.T) { // GIVEN a configuration file for an OHI with feature in it dir, err := tempFiles(map[string]string{ "foo.yaml": getV4VerboseCheckYAML(t), }) require.NoError(t, err) + defer removeTempFiles(t, dir) // AND an integrations manager and with feature enabled within agent config emitter := &testemit.RecordEmitter{} mgr := NewManager(ManagerConfig{ ConfigPaths: []string{dir}, - PassthroughEnvironment: passthroughEnv, + AgentFeatures: nil, + DefinitionFolders: nil, + Verbose: 0, TempDir: "/my-custom/path", + PassthroughEnvironment: passthroughEnv, }, config.NewPathLoader(), emitter, integration.ErrLookup, definitionQ, configEntryQ, track.NewTracker(nil), host.IDLookup{}) // AND the manager starts ctx, cancel := context.WithCancel(context.Background()) defer cancel() + go mgr.Start(ctx) d := getEmittedData(t, emitter, "verbose-check")