Skip to content

Commit

Permalink
Fix Linting issues (#1813)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarocabanas authored Feb 16, 2024
1 parent 359a7c8 commit b473ce7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/integrations/legacy/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 10 additions & 1 deletion pkg/integrations/v4/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit b473ce7

Please sign in to comment.