Skip to content

Commit

Permalink
[chore][connector/routing] Migrate logs tests to concise form
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed Nov 3, 2024
1 parent 8dd2b7b commit ff06430
Show file tree
Hide file tree
Showing 82 changed files with 524 additions and 4,486 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
}
Loading

0 comments on commit ff06430

Please sign in to comment.