SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
fix(alertmanager): fix tests for alertmanager (#7225)
Vibhu Pandey4177b88a4ea8
diff --git a/pkg/types/alertmanagertypes/config_test.go b/pkg/types/alertmanagertypes/config_test.goindex 3e4e1eb129..cfa6dec135 100644--- a/pkg/types/alertmanagertypes/config_test.go+++ b/pkg/types/alertmanagertypes/config_test.go@@ -2,12 +2,14 @@ package alertmanagertypesimport ("encoding/json"+ "fmt""net/url""testing""github.com/prometheus/alertmanager/config""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"+ "github.com/tidwall/gjson")func TestCreateRuleIDMatcher(t *testing.T) {@@ -111,12 +113,15 @@ func TestCreateRuleIDMatcher(t *testing.T) {assert.NoError(t, err)}- routes, err := json.Marshal(cfg.alertmanagerConfig.Route.Routes)+ actualRoutes, err := json.Marshal(cfg.alertmanagerConfig.Route.Routes)require.NoError(t, err)- var actualRoutes []map[string]any- err = json.Unmarshal(routes, &actualRoutes)+ expectedRoutes, err := json.Marshal(tc.expectedRoutes)require.NoError(t, err)- assert.ElementsMatch(t, tc.expectedRoutes, actualRoutes)++ for i := range len(tc.expectedRoutes) {+ assert.Equal(t, gjson.GetBytes(expectedRoutes, fmt.Sprintf("$[%d].receiver", i)).String(), gjson.GetBytes(actualRoutes, fmt.Sprintf("$[%d].receiver", i)).String())+ assert.ElementsMatch(t, gjson.GetBytes(expectedRoutes, fmt.Sprintf("$[%d].matchers", i)).Array(), gjson.GetBytes(actualRoutes, fmt.Sprintf("$[%d].matchers", i)).Array())+ }})}}