Skip to content

Commit

Permalink
[chore][connector/routing] Migrate logs tests to concise form (#36158)
Browse files Browse the repository at this point in the history
Follows
#36150

Finishes migrating logs tests to new concise format. 

Also includes minor nonfunctional refactoring in metrics test to match
what was needed for logs.
  • Loading branch information
djaglowski authored Nov 4, 2024
1 parent 7d48553 commit 2f1f790
Show file tree
Hide file tree
Showing 83 changed files with 525 additions and 4,487 deletions.
28 changes: 28 additions & 0 deletions connector/routingconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,31 @@ func TestValidateConfig(t *testing.T) {
})
}
}

type testConfigOption func(*Config)

func withRoute(context, condition string, pipelines ...pipeline.ID) testConfigOption {
return func(cfg *Config) {
cfg.Table = append(cfg.Table,
RoutingTableItem{
Context: context,
Condition: condition,
Pipelines: pipelines,
})
}
}

func withDefault(pipelines ...pipeline.ID) testConfigOption {
return func(cfg *Config) {
cfg.DefaultPipelines = pipelines
}
}

func testConfig(opts ...testConfigOption) *Config {
cfg := createDefaultConfig().(*Config)
cfg.MatchOnce = true
for _, opt := range opts {
opt(cfg)
}
return cfg
}
2 changes: 1 addition & 1 deletion connector/routingconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ require (
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
google.golang.org/grpc v1.67.1
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand Down Expand Up @@ -73,6 +72,7 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl => ../../pkg/ottl
Expand Down
Loading

0 comments on commit 2f1f790

Please sign in to comment.