Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulkaukuntla committed Mar 4, 2025
1 parent 1c79606 commit 48d2b50
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions comp/logs/agent/config/integration_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func (t *StringSliceField) UnmarshalYAML(unmarshal func(interface{}) error) erro
for _, item := range raw {
if str, ok := item.(string); ok {
*t = append(*t, str)
} else {
return fmt.Errorf("cannot unmarshal %v into a string", item)
}
}
return nil
Expand Down
9 changes: 6 additions & 3 deletions comp/logs/agent/config/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ foo:
`, `
- type: file
path: /var/log/app.log
tags: a, b:c
tags: nil
`, `
`}

for _, format := range invalidFormats {
configs, _ := ParseYAML([]byte(format))
for i, format := range invalidFormats {
configs, err := ParseYAML([]byte(format))
if i == 1 {
assert.NotNil(t, err)
}
require.Equal(t, 0, len(configs))
}
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/logs/launchers/container/tailerfactory/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"runtime"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/fx"

Expand All @@ -24,7 +23,7 @@ import (
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
workloadmetafxmock "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx-mock"
workloadmetamock "github.com/DataDog/datadog-agent/comp/core/workloadmeta/mock"
config "github.com/DataDog/datadog-agent/comp/logs/agent/config"
"github.com/DataDog/datadog-agent/comp/logs/agent/config"
configmock "github.com/DataDog/datadog-agent/pkg/config/mock"
"github.com/DataDog/datadog-agent/pkg/logs/internal/util/containersorpods"
"github.com/DataDog/datadog-agent/pkg/logs/pipeline"
Expand Down Expand Up @@ -318,7 +317,7 @@ func TestMakeK8sSource(t *testing.T) {
require.Equal(t, wildcard, child.Config.Path)
require.Equal(t, "src", child.Config.Source)
require.Equal(t, "svc", child.Config.Service)
assert.EqualValues(t, config.StringSliceField{"tag!"}, child.Config.Tags)
require.Equal(t, []string{"tag!"}, []string(child.Config.Tags))
require.Equal(t, *child.Config.AutoMultiLine, true)
require.Equal(t, child.Config.AutoMultiLineSampleSize, 123)
require.Equal(t, child.Config.AutoMultiLineMatchThreshold, 0.123)
Expand Down
2 changes: 1 addition & 1 deletion pkg/logs/schedulers/channel/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ func TestScheduler(t *testing.T) {

require.Equal(t, len(spy.Events), 1) // no change
assert.Nil(t, source.Config.Tags)
assert.Equal(t, config.StringSliceField{"foo"}, source.Config.ChannelTags)
assert.Equal(t, []string{"foo"}, []string(source.Config.ChannelTags))
}

0 comments on commit 48d2b50

Please sign in to comment.