diff --git a/test/e2e/nodeagentconfig/node-agent-config.go b/test/e2e/nodeagentconfig/node-agent-config.go index dc88d98bd..5266bffc5 100644 --- a/test/e2e/nodeagentconfig/node-agent-config.go +++ b/test/e2e/nodeagentconfig/node-agent-config.go @@ -77,6 +77,14 @@ var LoadAffinities func() = TestFunc(&NodeAgentConfigTestCase{ IgnoreDelayBinding: true, }, PriorityClassName: test.PriorityClassNameForDataMover, + // Explicitly add custom labels and annotations to be tested + PodLabels: map[string]string{ + "spectrocloud.com/connection": "proxy", // Tests appending custom labels (Issue #9435) + "azure.workload.identity/use": "true", // Tests overwriting built-in labels + }, + PodAnnotations: map[string]string{ + "test-data-mover-annotation": "true", + }, }, nodeAgentConfigMapName: "node-agent-config", }) @@ -247,6 +255,16 @@ func (n *NodeAgentConfigTestCase) Backup() error { // but we can verify if the expected affinity is contained in the pod affinity. Expect(backupPodList.Items[0].Spec.Affinity.String()).To(ContainSubstring(expectedLabelKey)) + // Verify PodLabels + for k, v := range n.nodeAgentConfigs.PodLabels { + Expect(backupPodList.Items[0].Labels[k]).To(Equal(v)) + } + + // Verify PodAnnotations + for k, v := range n.nodeAgentConfigs.PodAnnotations { + Expect(backupPodList.Items[0].Annotations[k]).To(Equal(v)) + } + fmt.Println("backupPod content verification completed successfully.") wait.PollUntilContextTimeout(n.Ctx, 5*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) { @@ -328,6 +346,16 @@ func (n *NodeAgentConfigTestCase) Restore() error { // but we can verify if the expected affinity is contained in the pod affinity. Expect(restorePodList.Items[0].Spec.Affinity.String()).To(ContainSubstring(expectedLabelKey)) + // Verify PodLabels + for k, v := range n.nodeAgentConfigs.PodLabels { + Expect(restorePodList.Items[0].Labels[k]).To(Equal(v)) + } + + // Verify PodAnnotations + for k, v := range n.nodeAgentConfigs.PodAnnotations { + Expect(restorePodList.Items[0].Annotations[k]).To(Equal(v)) + } + fmt.Println("restorePod content verification completed successfully.") wait.PollUntilContextTimeout(n.Ctx, 5*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) {