Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][connector/routing] Migrate logs tests to concise form #36158

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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