Small unit test changes for deleter_test.go

This commit is contained in:
Ryan Richard 2020-11-02 08:40:39 -08:00
parent f76b9857da
commit 7597b12a51

View File

@ -317,7 +317,7 @@ func TestDeleterControllerSync(t *testing.T) {
it.Before(func() { it.Before(func() {
updatedAgentPod := agentPod.DeepCopy() updatedAgentPod := agentPod.DeepCopy()
updatedAgentPod.ObjectMeta.Labels = map[string]string{ updatedAgentPod.ObjectMeta.Labels = map[string]string{
agentPodLabelKey: agentPodLabelValue, "kube-cert-agent.pinniped.dev": "true",
// the value of a label is wrong so the pod should be deleted so it can get recreated with the new labels // the value of a label is wrong so the pod should be deleted so it can get recreated with the new labels
"myLabelKey1": "myLabelValue1-outdated-value", "myLabelKey1": "myLabelValue1-outdated-value",
"myLabelKey2": "myLabelValue2-outdated-value", "myLabelKey2": "myLabelValue2-outdated-value",
@ -335,11 +335,11 @@ func TestDeleterControllerSync(t *testing.T) {
}) })
}) })
when("an additional label was added", func() { when("an additional custom label was added since the agent pod was created", func() {
it.Before(func() { it.Before(func() {
updatedAgentPod := agentPod.DeepCopy() updatedAgentPod := agentPod.DeepCopy()
updatedAgentPod.ObjectMeta.Labels = map[string]string{ updatedAgentPod.ObjectMeta.Labels = map[string]string{
agentPodLabelKey: agentPodLabelValue, "kube-cert-agent.pinniped.dev": "true",
"myLabelKey1": "myLabelValue1", "myLabelKey1": "myLabelValue1",
// "myLabelKey2" is missing so the pod should be deleted so it can get recreated with the new labels // "myLabelKey2" is missing so the pod should be deleted so it can get recreated with the new labels
} }
@ -360,7 +360,7 @@ func TestDeleterControllerSync(t *testing.T) {
it.Before(func() { it.Before(func() {
updatedAgentPod := agentPod.DeepCopy() updatedAgentPod := agentPod.DeepCopy()
updatedAgentPod.ObjectMeta.Labels = map[string]string{ updatedAgentPod.ObjectMeta.Labels = map[string]string{
agentPodLabelKey: agentPodLabelValue, "kube-cert-agent.pinniped.dev": "true",
"myLabelKey1": "myLabelValue1", "myLabelKey1": "myLabelValue1",
"myLabelKey2": "myLabelValue2", "myLabelKey2": "myLabelValue2",
"extra-label": "not-related-to-the-sepcified-additional-labels", "extra-label": "not-related-to-the-sepcified-additional-labels",