Skip to content

Commit 1056305

Browse files
authored
Merge pull request #9565 from hollycai05/add-e2e-tests-for-PR9452
Add e2e test case for PR 9452
2 parents ca41757 + 89ead22 commit 1056305

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

test/e2e/nodeagentconfig/node-agent-config.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ var LoadAffinities func() = TestFunc(&NodeAgentConfigTestCase{
7777
IgnoreDelayBinding: true,
7878
},
7979
PriorityClassName: test.PriorityClassNameForDataMover,
80+
// Explicitly add custom labels and annotations to be tested
81+
PodLabels: map[string]string{
82+
"spectrocloud.com/connection": "proxy", // Tests appending custom labels (Issue #9435)
83+
"azure.workload.identity/use": "true", // Tests overwriting built-in labels
84+
},
85+
PodAnnotations: map[string]string{
86+
"test-data-mover-annotation": "true",
87+
},
8088
},
8189
nodeAgentConfigMapName: "node-agent-config",
8290
})
@@ -247,6 +255,16 @@ func (n *NodeAgentConfigTestCase) Backup() error {
247255
// but we can verify if the expected affinity is contained in the pod affinity.
248256
Expect(backupPodList.Items[0].Spec.Affinity.String()).To(ContainSubstring(expectedLabelKey))
249257

258+
// Verify PodLabels
259+
for k, v := range n.nodeAgentConfigs.PodLabels {
260+
Expect(backupPodList.Items[0].Labels[k]).To(Equal(v))
261+
}
262+
263+
// Verify PodAnnotations
264+
for k, v := range n.nodeAgentConfigs.PodAnnotations {
265+
Expect(backupPodList.Items[0].Annotations[k]).To(Equal(v))
266+
}
267+
250268
fmt.Println("backupPod content verification completed successfully.")
251269

252270
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 {
328346
// but we can verify if the expected affinity is contained in the pod affinity.
329347
Expect(restorePodList.Items[0].Spec.Affinity.String()).To(ContainSubstring(expectedLabelKey))
330348

349+
// Verify PodLabels
350+
for k, v := range n.nodeAgentConfigs.PodLabels {
351+
Expect(restorePodList.Items[0].Labels[k]).To(Equal(v))
352+
}
353+
354+
// Verify PodAnnotations
355+
for k, v := range n.nodeAgentConfigs.PodAnnotations {
356+
Expect(restorePodList.Items[0].Annotations[k]).To(Equal(v))
357+
}
358+
331359
fmt.Println("restorePod content verification completed successfully.")
332360

333361
wait.PollUntilContextTimeout(n.Ctx, 5*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) {

0 commit comments

Comments
 (0)