Fix unit tests
This commit is contained in:
parent
32a6245e0f
commit
f52dc42171
|
|
@ -59,6 +59,7 @@ func (c *Configuration) getJenkinsMasterPod() (*corev1.Pod, error) {
|
||||||
return currentJenkinsMasterPod, nil
|
return currentJenkinsMasterPod, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsJenkinsTerminating returns true if the Jenkins pod is terminating
|
||||||
func (c *Configuration) IsJenkinsTerminating(pod corev1.Pod) bool {
|
func (c *Configuration) IsJenkinsTerminating(pod corev1.Pod) bool {
|
||||||
return pod.ObjectMeta.DeletionTimestamp != nil
|
return pod.ObjectMeta.DeletionTimestamp != nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,12 @@ func TestPodRestartPrepend(t *testing.T) {
|
||||||
res := "test-reason"
|
res := "test-reason"
|
||||||
podRestart := NewPodRestart(KubernetesSource, []string{res})
|
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) {
|
t.Run("happy with multiple message", func(t *testing.T) {
|
||||||
podRestart := NewPodRestart(KubernetesSource, []string{"first-reason", "second-reason", "third-reason"})
|
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])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue