From 7597b12a511e755b3bc176ba894494a3f6beed10 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Mon, 2 Nov 2020 08:40:39 -0800 Subject: [PATCH] Small unit test changes for deleter_test.go --- .../controller/kubecertagent/deleter_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/controller/kubecertagent/deleter_test.go b/internal/controller/kubecertagent/deleter_test.go index 30dff398..d8d528ca 100644 --- a/internal/controller/kubecertagent/deleter_test.go +++ b/internal/controller/kubecertagent/deleter_test.go @@ -317,7 +317,7 @@ func TestDeleterControllerSync(t *testing.T) { it.Before(func() { updatedAgentPod := agentPod.DeepCopy() 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 "myLabelKey1": "myLabelValue1-outdated-value", "myLabelKey2": "myLabelValue2-outdated-value", @@ -335,12 +335,12 @@ 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() { updatedAgentPod := agentPod.DeepCopy() updatedAgentPod.ObjectMeta.Labels = map[string]string{ - agentPodLabelKey: agentPodLabelValue, - "myLabelKey1": "myLabelValue1", + "kube-cert-agent.pinniped.dev": "true", + "myLabelKey1": "myLabelValue1", // "myLabelKey2" is missing so the pod should be deleted so it can get recreated with the new labels } r.NoError(agentInformerClient.Tracker().Update(podsGVR, updatedAgentPod, updatedAgentPod.Namespace)) @@ -360,10 +360,10 @@ func TestDeleterControllerSync(t *testing.T) { it.Before(func() { updatedAgentPod := agentPod.DeepCopy() updatedAgentPod.ObjectMeta.Labels = map[string]string{ - agentPodLabelKey: agentPodLabelValue, - "myLabelKey1": "myLabelValue1", - "myLabelKey2": "myLabelValue2", - "extra-label": "not-related-to-the-sepcified-additional-labels", + "kube-cert-agent.pinniped.dev": "true", + "myLabelKey1": "myLabelValue1", + "myLabelKey2": "myLabelValue2", + "extra-label": "not-related-to-the-sepcified-additional-labels", } r.NoError(agentInformerClient.Tracker().Update(podsGVR, updatedAgentPod, updatedAgentPod.Namespace)) r.NoError(kubeAPIClient.Tracker().Update(podsGVR, updatedAgentPod, updatedAgentPod.Namespace))