Skip to content

Commit 9dc3126

Browse files
authored
Fixed condition (#172)
1 parent b880735 commit 9dc3126

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pkg/monitoring/datadog.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func newDatadog() datadog {
4242
}
4343

4444
func (d datadog) SuccessEvent(jobInfo JobInfo) (err error) {
45-
if isSubscriptionSuppressed(jobInfo.Annotations, suppressFailedAnnotationName) {
45+
if isSubscriptionSuppressed(jobInfo.Annotations, suppressSuccessAnnotationName) {
4646
klog.Infof("Notification for %s is suppressed", jobInfo.Name)
4747
return nil
4848
}
@@ -66,7 +66,7 @@ func (d datadog) SuccessEvent(jobInfo JobInfo) (err error) {
6666
}
6767

6868
func (d datadog) FailEvent(jobInfo JobInfo) (err error) {
69-
if isSubscriptionSuppressed(jobInfo.Annotations, suppressSuccessAnnotationName) {
69+
if isSubscriptionSuppressed(jobInfo.Annotations, suppressFailedAnnotationName) {
7070
klog.Infof("Notification for %s is suppressed", jobInfo.Name)
7171
return nil
7272
}

pkg/monitoring/datadog_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ func TestisSubscriptionSuppressed(t *testing.T) {
5454
"kube-job-notifier/suppress-success-datadog-subscription",
5555
true,
5656
},
57+
{
58+
"Annotation not true",
59+
map[string]string{
60+
"kube-job-notifier/suppress-failed-datadog-subscription": "false",
61+
},
62+
"kube-job-notifier/suppress-failed-datadog-subscription",
63+
false,
64+
},
65+
{
66+
"Annotation true",
67+
map[string]string{
68+
"kube-job-notifier/suppress-failed-datadog-subscription": "true",
69+
},
70+
"kube-job-notifier/suppress-failed-datadog-subscription",
71+
true,
72+
},
5773
{
5874
"Nil annotation not break",
5975
nil,

0 commit comments

Comments
 (0)