Skip to content

Commit

Permalink
[chore] Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovrus committed Aug 16, 2022
1 parent 7ec10c2 commit 9486cf0
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 37 deletions.
3 changes: 1 addition & 2 deletions processor/k8sattributesprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import (
"path/filepath"
"testing"

"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor/internal/kube"
Expand Down
5 changes: 2 additions & 3 deletions processor/logstransformprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/adapter"
)
Expand Down
2 changes: 1 addition & 1 deletion processor/logstransformprocessor/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ operators:
parse_from: attributes.time
layout: '%Y-%m-%d %H:%M:%S'
severity:
parse_from: attributes.sev
parse_from: attributes.sev
11 changes: 5 additions & 6 deletions processor/metricsgenerationprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import (
"path/filepath"
"testing"

"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/confmap/confmaptest"
)

func TestLoadConfig(t *testing.T) {
Expand Down Expand Up @@ -99,12 +98,12 @@ func TestLoadConfig(t *testing.T) {
require.NoError(t, err)
require.NoError(t, config.UnmarshalProcessor(sub, cfg))

if tt.expected != nil {
assert.NoError(t, cfg.Validate())
assert.Equal(t, tt.expected, cfg)
} else {
if tt.expected == nil {
assert.EqualError(t, cfg.Validate(), tt.errorMessage)
return
}
assert.NoError(t, cfg.Validate())
assert.Equal(t, tt.expected, cfg)
})
}
}
13 changes: 3 additions & 10 deletions processor/metricsgenerationprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ package metricsgenerationprocessor
import (
"context"
"path/filepath"
"strings"
"testing"

"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configtest"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/consumer/consumertest"
)

Expand Down Expand Up @@ -58,12 +56,7 @@ func TestCreateProcessors(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

var id string
parts := strings.Split(k, "/")
if len(parts) > 1 {
id = parts[1]
}
sub, err := cm.Sub(config.NewComponentIDWithName(typeStr, id).String())
sub, err := cm.Sub(k)
require.NoError(t, err)
require.NoError(t, config.UnmarshalProcessor(sub, cfg))

Expand Down
3 changes: 1 addition & 2 deletions processor/metricstransformprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import (
"path/filepath"
"testing"

"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/confmap/confmaptest"
)

func TestLoadConfig(t *testing.T) {
Expand Down
13 changes: 3 additions & 10 deletions processor/metricstransformprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ import (
"fmt"
"path/filepath"
"reflect"
"strings"
"testing"

"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configtest"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/consumer/consumertest"
)

Expand Down Expand Up @@ -131,12 +129,7 @@ func TestCreateProcessors(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

var id string
parts := strings.Split(k, "/")
if len(parts) > 1 {
id = parts[1]
}
sub, err := cm.Sub(config.NewComponentIDWithName(typeStr, id).String())
sub, err := cm.Sub(k)
require.NoError(t, err)
require.NoError(t, config.UnmarshalProcessor(sub, cfg))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ probabilistic_sampler:
# intended.
hash_seed: 22

probabilistic_sampler/empty:
probabilistic_sampler/empty:
3 changes: 1 addition & 2 deletions processor/redactionprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import (
"path/filepath"
"testing"

"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/confmap/confmaptest"
)

func TestLoadConfig(t *testing.T) {
Expand Down

0 comments on commit 9486cf0

Please sign in to comment.