Adds additional test case for alternate attached namespace scenario

This commit is contained in:
AshMenhennett 2020-01-24 20:36:36 +11:00
parent dce5b81642
commit 990b69efba

View file

@ -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",