@@ -93,6 +93,9 @@ func TestJiraTemplating(t *testing.T) {
93
93
cfg : & config.JiraConfig {
94
94
Summary : `{{ template "jira.default.summary" . }}` ,
95
95
Description : `{{ template "jira.default.description" . }}` ,
96
+ Fields : map [string ]any {
97
+ "customfield_14400" : `{{ template "jira.host" . }}` ,
98
+ },
96
99
},
97
100
retry : false ,
98
101
},
@@ -228,6 +231,7 @@ func TestJiraNotify(t *testing.T) {
228
231
"customfield_10006" : []map [any ]any {{"value" : "red" }, {"value" : "blue" }, {"value" : "green" }},
229
232
"customfield_10007" : []map [any ]any {{"value" : "red" }, {"value" : "blue" }, {"value" : 0 }},
230
233
"customfield_10008" : []map [any ]any {{"value" : 0 }, {"value" : 1 }, {"value" : 2 }},
234
+ "customfield_14400" : `{{ template "jira.host" . }}` ,
231
235
},
232
236
ReopenDuration : model .Duration (1 * time .Hour ),
233
237
ReopenTransition : "REOPEN" ,
@@ -239,6 +243,7 @@ func TestJiraNotify(t *testing.T) {
239
243
Labels : model.LabelSet {
240
244
"alertname" : "test" ,
241
245
"instance" : "vm1" ,
246
+ "hostname" : "host1.exmple.com" ,
242
247
},
243
248
StartsAt : time .Now (),
244
249
EndsAt : time .Now ().Add (time .Hour ),
@@ -252,14 +257,15 @@ func TestJiraNotify(t *testing.T) {
252
257
Key : "" ,
253
258
Fields : & issueFields {
254
259
Summary : strings .Repeat ("A" , maxSummaryLenRunes - 1 ) + "…" ,
255
- Description : "\n \n # Alerts Firing:\n \n Labels:\n - alertname = test\n - instance = vm1\n \n Annotations:\n \n Source: \n \n \n \n \n " ,
260
+ Description : "\n \n # Alerts Firing:\n \n Labels:\n - alertname = test\n - hostname = host1.exmple.com \n - instance = vm1\n \n Annotations:\n \n Source: \n \n \n \n \n " ,
256
261
Issuetype : & idNameValue {Name : "Incident" },
257
262
Labels : []string {"ALERT{6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b}" , "alertmanager" , "test" },
258
263
Project : & issueProject {Key : "OPS" },
259
264
},
260
265
},
261
266
customFieldAssetFn : func (t * testing.T , issue map [string ]any ) {
262
267
require .Equal (t , "value" , issue ["customfield_10001" ])
268
+ require .Equal (t , "host1.exmple.com" , issue ["customfield_14400" ])
263
269
require .Equal (t , float64 (0 ), issue ["customfield_10002" ])
264
270
require .Equal (t , []any {float64 (0 )}, issue ["customfield_10003" ])
265
271
require .Equal (t , map [string ]any {"value" : "red" }, issue ["customfield_10004" ])
0 commit comments