Skip to content

Commit

Permalink
[connector/routing] Fix configuration error with request context
Browse files Browse the repository at this point in the history
Remove a residual fallthrough keyword

Fixes #37410

Added unit tests for valid request context.

Updated changelog.
  • Loading branch information
vlaborie committed Jan 24, 2025
1 parent a05740a commit 5a24138
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ If you are looking for developer-facing changes, check out [CHANGELOG-API.md](./

<!-- next version -->

### 🧰 Bug fixes 🧰

- `routingconnector`: Fix config validation when using request context. (#37410)

## v0.118.0

### 🛑 Breaking changes 🛑
Expand Down
1 change: 0 additions & 1 deletion connector/routingconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (c *Config) Validate() error {
if _, err := parseRequestCondition(item.Condition); err != nil {
return err
}
fallthrough
default:
return errors.New("invalid context: " + item.Context)
}
Expand Down
14 changes: 14 additions & 0 deletions connector/routingconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,20 @@ func TestValidateConfig(t *testing.T) {
},
error: `"request" context requires a 'condition'`,
},
{
name: "request context with condition",
config: &Config{
Table: []RoutingTableItem{
{
Context: "request",
Condition: `request["attr"] == "acme"`,
Pipelines: []pipeline.ID{
pipeline.NewIDWithName(pipeline.SignalTraces, "otlp"),
},
},
},
},
},
{
name: "request context with invalid condition",
config: &Config{
Expand Down

0 comments on commit 5a24138

Please sign in to comment.