diff --git a/pkg/naming/metrics_query_test.go b/pkg/naming/metrics_query_test.go index 71d27ce0..d6f306f7 100644 --- a/pkg/naming/metrics_query_test.go +++ b/pkg/naming/metrics_query_test.go @@ -372,6 +372,21 @@ func TestBuildExternalSelector(t *testing.T) { hasSelector(`foo="bar",namespaces="default"`), ), }, + { + name: "single LabelMatchers value with namespace alt - explicit attached namespace", + + mq: mustNewQuery(`<<.LabelMatchers>>`), + namespace: "staging", + options: config.Options{DetatchFromNamespace: false}, + metricSelector: labels.NewSelector().Add( + *mustNewLabelRequirement("foo", selection.Equals, []string{"bar"}), + ), + + check: checks( + hasError(nil), + hasSelector(`foo="bar",namespaces="staging"`), + ), + }, { name: "multiple LabelMatchers value",