@@ -10,6 +10,7 @@ import (
10
10
"github.com/prometheus/prometheus/config"
11
11
"github.com/prometheus/prometheus/discovery"
12
12
"github.com/prometheus/prometheus/discovery/dns"
13
+ "github.com/prometheus/prometheus/model/labels"
13
14
"github.com/stretchr/testify/require"
14
15
15
16
"github.com/cortexproject/cortex/pkg/util"
@@ -220,6 +221,38 @@ func TestBuildNotifierConfig(t *testing.T) {
220
221
},
221
222
},
222
223
},
224
+ {
225
+ name : "with external labels" ,
226
+ cfg : & Config {
227
+ AlertmanagerURL : "http://alertmanager.default.svc.cluster.local/alertmanager" ,
228
+ ExternalLabels : []labels.Label {
229
+ {Name : "region" , Value : "us-east-1" },
230
+ },
231
+ },
232
+ ncfg : & config.Config {
233
+ AlertingConfig : config.AlertingConfig {
234
+ AlertmanagerConfigs : []* config.AlertmanagerConfig {
235
+ {
236
+ APIVersion : "v1" ,
237
+ Scheme : "http" ,
238
+ PathPrefix : "/alertmanager" ,
239
+ ServiceDiscoveryConfigs : discovery.Configs {
240
+ discovery.StaticConfig {
241
+ {
242
+ Targets : []model.LabelSet {{"__address__" : "alertmanager.default.svc.cluster.local" }},
243
+ },
244
+ },
245
+ },
246
+ },
247
+ },
248
+ },
249
+ GlobalConfig : config.GlobalConfig {
250
+ ExternalLabels : []labels.Label {
251
+ {Name : "region" , Value : "us-east-1" },
252
+ },
253
+ },
254
+ },
255
+ },
223
256
}
224
257
225
258
for _ , tt := range tests {
0 commit comments