@@ -747,6 +747,66 @@ func TestJiraNotify(t *testing.T) {
747747 customFieldAssetFn : func (t * testing.T , issue map [string ]any ) {},
748748 errMsg : "can't find transition REOPEN for issue OPS-3" ,
749749 },
750+ {
751+ title : "update existing issue when setting disableupdatedescription to true" ,
752+ cfg : & config.JiraConfig {
753+ Summary : `{{ template "jira.default.summary" . }}` ,
754+ Description : `{{ template "jira.default.description" . }}` ,
755+ IssueType : "Incident" ,
756+ Project : "OPS" ,
757+ Priority : `{{ template "jira.default.priority" . }}` ,
758+ Labels : []string {"alertmanager" , "{{ .GroupLabels.alertname }}" },
759+ DisableUpdateDescription : true ,
760+ },
761+ alert : & types.Alert {
762+ Alert : model.Alert {
763+ Labels : model.LabelSet {
764+ "alertname" : "test" ,
765+ "instance" : "vm1" ,
766+ "severity" : "critical" ,
767+ },
768+ StartsAt : time .Now (),
769+ EndsAt : time .Now ().Add (time .Hour ),
770+ },
771+ },
772+ searchResponse : issueSearchResult {
773+ Issues : []issue {
774+ {
775+ Key : "OPS-4" ,
776+ Fields : & issueFields {
777+ Status : & issueStatus {
778+ Name : "Open" ,
779+ StatusCategory : struct {
780+ Key string `json:"key"`
781+ }{
782+ Key : "open" ,
783+ },
784+ },
785+ },
786+ },
787+ },
788+ },
789+ issue : issue {
790+ Key : "" ,
791+ Fields : & issueFields {
792+ Summary : "[FIRING:1] test (vm1 critical)" ,
793+ Description : nil ,
794+ Issuetype : & idNameValue {Name : "Incident" },
795+ Labels : []string {
796+ "ALERT{6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b}" ,
797+ "alertmanager" ,
798+ "test" ,
799+ },
800+ Project : & issueProject {Key : "OPS" },
801+ Priority : & idNameValue {Name : "High" },
802+ },
803+ },
804+ customFieldAssetFn : func (t * testing.T , fields map [string ]any ) {
805+ _ , has := fields ["description" ]
806+ require .False (t , has , "description field must be omitted on update when UpdateDescription=false" )
807+ },
808+ errMsg : "" ,
809+ },
750810 } {
751811 tc := tc
752812
@@ -841,6 +901,7 @@ func TestJiraNotify(t *testing.T) {
841901 case "/issue/OPS-1" :
842902 case "/issue/OPS-2" :
843903 case "/issue/OPS-3" :
904+ case "/issue/OPS-4" :
844905 fallthrough
845906 case "/issue" :
846907 body , err := io .ReadAll (r .Body )
0 commit comments