alertmanager/dispatch
George Robinson 036eb508df
Fix `Route.ID()` returns conflicting IDs (#3803)
* Update TestRouteID tests

This commit updates the TestRouteID tests to be more simple without
reducing test coverage. It also adds new cases that show a bug
in the existing code where conflicting IDs can be returned.

Signed-off-by: George Robinson <george.robinson@grafana.com>

* Fix Route.ID() returns conflicting IDs

This commit fixes a bug where Route.ID() returns conflicting IDs.
For example, the configuration:

    receiver: test
    routes:
    - matchers:
        - foo=bar
      continue: true
      routes:
      - matchers:
        - bar=baz
    - matchers:
        - foo=bar
      continue: true
      routes:
      - matchers:
        - bar=baz

Gives the following Route IDs:

    {}
    {}/{foo="bar"}/0
    {}/{foo="bar"}/{bar="baz"}/0
    {}/{foo="bar"}/1
    {}/{foo="bar"}/{bar="baz"}/0

When it should give these Route IDs:

    {}
    {}/{foo="bar"}/0
    {}/{foo="bar"}/0/{bar="baz"}/0
    {}/{foo="bar"}/1
    {}/{foo="bar"}/1/{bar="baz"}/0

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-12 10:40:14 +02:00
..
dispatch.go use Go standard errors 2023-12-08 16:44:13 +01:00
dispatch_test.go golangci-lint: enable testifylint linter 2023-12-10 08:50:03 +00:00
route.go Fix `Route.ID()` returns conflicting IDs (#3803) 2024-04-12 10:40:14 +02:00
route_test.go Fix `Route.ID()` returns conflicting IDs (#3803) 2024-04-12 10:40:14 +02:00