diff --git a/retrieval/targetmanager_test.go b/retrieval/targetmanager_test.go index b192a10c0d..2eb5d9d756 100644 --- a/retrieval/targetmanager_test.go +++ b/retrieval/targetmanager_test.go @@ -313,44 +313,109 @@ func TestTargetManagerConfigUpdate(t *testing.T) { scrapeConfigs: []*config.ScrapeConfig{testJob1}, expected: map[string][]model.LabelSet{ "test_job1:static:0:0": { - {model.JobLabel: "test_job1", model.InstanceLabel: "example.org:80", "testParam": "paramValue", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.org:80", model.ParamLabelPrefix + "testParam": "paramValue"}, - {model.JobLabel: "test_job1", model.InstanceLabel: "example.com:80", "testParam": "paramValue", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.com:80", model.ParamLabelPrefix + "testParam": "paramValue"}, + { + model.JobLabel: "test_job1", + model.InstanceLabel: "example.org:80", + "testParam": "paramValue", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.org:80", + model.ParamLabelPrefix + "testParam": "paramValue", + }, + { + model.JobLabel: "test_job1", + model.InstanceLabel: "example.com:80", + "testParam": "paramValue", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.com:80", + model.ParamLabelPrefix + "testParam": "paramValue"}, }, }, }, { scrapeConfigs: []*config.ScrapeConfig{testJob1}, expected: map[string][]model.LabelSet{ "test_job1:static:0:0": { - {model.JobLabel: "test_job1", model.InstanceLabel: "example.org:80", "testParam": "paramValue", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.org:80", model.ParamLabelPrefix + "testParam": "paramValue"}, - {model.JobLabel: "test_job1", model.InstanceLabel: "example.com:80", "testParam": "paramValue", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.com:80", model.ParamLabelPrefix + "testParam": "paramValue"}, + { + model.JobLabel: "test_job1", + model.InstanceLabel: "example.org:80", + "testParam": "paramValue", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.org:80", + model.ParamLabelPrefix + "testParam": "paramValue", + }, + { + model.JobLabel: "test_job1", + model.InstanceLabel: "example.com:80", + "testParam": "paramValue", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.com:80", + model.ParamLabelPrefix + "testParam": "paramValue", + }, }, }, }, { scrapeConfigs: []*config.ScrapeConfig{testJob1, testJob2}, expected: map[string][]model.LabelSet{ "test_job1:static:0:0": { - {model.JobLabel: "test_job1", model.InstanceLabel: "example.org:80", "testParam": "paramValue", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.org:80", model.ParamLabelPrefix + "testParam": "paramValue"}, - {model.JobLabel: "test_job1", model.InstanceLabel: "example.com:80", "testParam": "paramValue", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.com:80", model.ParamLabelPrefix + "testParam": "paramValue"}, + { + model.JobLabel: "test_job1", + model.InstanceLabel: "example.org:80", + "testParam": "paramValue", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.org:80", + model.ParamLabelPrefix + "testParam": "paramValue", + }, + { + model.JobLabel: "test_job1", + model.InstanceLabel: "example.com:80", + "testParam": "paramValue", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.com:80", + model.ParamLabelPrefix + "testParam": "paramValue", + }, }, "test_job2:static:0:0": { - {model.JobLabel: "test_job2", model.InstanceLabel: "example.org:8080", "foo": "bar", "new": "ox-ba", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.org:8080"}, - {model.JobLabel: "test_job2", model.InstanceLabel: "example.com:8081", "foo": "bar", "new": "ox-ba", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.com:8081"}, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "example.org:8080", + "foo": "bar", + "new": "ox-ba", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.org:8080", + }, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "example.com:8081", + "foo": "bar", + "new": "ox-ba", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.com:8081", + }, }, "test_job2:static:0:1": { - {model.JobLabel: "test_job2", model.InstanceLabel: "foo.com:1234", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "foo.com:1234"}, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "foo.com:1234", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "foo.com:1234", + }, }, "test_job2:static:0:2": { - {model.JobLabel: "test_job2", model.InstanceLabel: "fixed", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "foo.com:1235"}, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "fixed", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "foo.com:1235", + }, }, }, }, { @@ -360,18 +425,41 @@ func TestTargetManagerConfigUpdate(t *testing.T) { scrapeConfigs: []*config.ScrapeConfig{testJob2}, expected: map[string][]model.LabelSet{ "test_job2:static:0:0": { - {model.JobLabel: "test_job2", model.InstanceLabel: "example.org:8080", "foo": "bar", "new": "ox-ba", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.org:8080"}, - {model.JobLabel: "test_job2", model.InstanceLabel: "example.com:8081", "foo": "bar", "new": "ox-ba", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "example.com:8081"}, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "example.org:8080", + "foo": "bar", + "new": "ox-ba", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.org:8080"}, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "example.com:8081", + "foo": "bar", + "new": "ox-ba", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "example.com:8081", + }, }, "test_job2:static:0:1": { - {model.JobLabel: "test_job2", model.InstanceLabel: "foo.com:1234", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "foo.com:1234"}, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "foo.com:1234", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "foo.com:1234", + }, }, "test_job2:static:0:2": { - {model.JobLabel: "test_job2", model.InstanceLabel: "fixed", - model.SchemeLabel: "", model.MetricsPathLabel: "", model.AddressLabel: "foo.com:1235"}, + { + model.JobLabel: "test_job2", + model.InstanceLabel: "fixed", + model.SchemeLabel: "", + model.MetricsPathLabel: "", + model.AddressLabel: "foo.com:1235", + }, }, }, }, {