diff --git a/pkg/controller/jenkins/configuration/configuration.go b/pkg/controller/jenkins/configuration/configuration.go index c05db7d0..4bb21f07 100644 --- a/pkg/controller/jenkins/configuration/configuration.go +++ b/pkg/controller/jenkins/configuration/configuration.go @@ -59,6 +59,7 @@ func (c *Configuration) getJenkinsMasterPod() (*corev1.Pod, error) { return currentJenkinsMasterPod, nil } +// IsJenkinsTerminating returns true if the Jenkins pod is terminating func (c *Configuration) IsJenkinsTerminating(pod corev1.Pod) bool { return pod.ObjectMeta.DeletionTimestamp != nil } diff --git a/pkg/controller/jenkins/notifications/reason/reason_test.go b/pkg/controller/jenkins/notifications/reason/reason_test.go index a923daf6..e92b7d52 100644 --- a/pkg/controller/jenkins/notifications/reason/reason_test.go +++ b/pkg/controller/jenkins/notifications/reason/reason_test.go @@ -67,12 +67,12 @@ func TestPodRestartPrepend(t *testing.T) { res := "test-reason" podRestart := NewPodRestart(KubernetesSource, []string{res}) - assert.Equal(t, podRestart.short[0], fmt.Sprintf("Jenkins master pod restarted by: %s", res)) + assert.Equal(t, fmt.Sprintf("Jenkins master pod restarted by %s: %s", KubernetesSource, res), podRestart.short[0]) }) t.Run("happy with multiple message", func(t *testing.T) { podRestart := NewPodRestart(KubernetesSource, []string{"first-reason", "second-reason", "third-reason"}) - assert.Equal(t, podRestart.short[0], "Jenkins master pod restarted by:") + assert.Equal(t, fmt.Sprintf("Jenkins master pod restarted by %s:", KubernetesSource), podRestart.short[0]) }) }