Skip to content

Commit 082b7cc

Browse files
chore: Cleanup a lot of code
1 parent 6ac8f5d commit 082b7cc

38 files changed

Lines changed: 388 additions & 823 deletions

test/e2e/README.md

Lines changed: 70 additions & 470 deletions
Large diffs are not rendered by default.

test/e2e/advanced/job_reload_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ var _ = Describe("Job Workload Recreation Tests", func() {
184184

185185
Context("Job with SecretProviderClass reference", Label("csi"), func() {
186186
BeforeEach(func() {
187-
// Skip if CSI driver not installed
188187
if !utils.IsCSIDriverInstalled(ctx, csiClient) {
189188
Skip("CSI secrets store driver not installed - skipping CSI test")
190189
}
191-
// Skip if Vault CSI provider not installed
192190
if !utils.IsVaultProviderInstalled(ctx, kubeClient) {
193191
Skip("Vault CSI provider not installed - skipping CSI test")
194192
}
@@ -209,6 +207,7 @@ var _ = Describe("Job Workload Recreation Tests", func() {
209207

210208
By("Creating a Job with CSI volume and SPC reload annotation")
211209
job, err := utils.CreateJob(ctx, kubeClient, testNamespace, jobName,
210+
utils.WithJobCommand("sleep 300"),
212211
utils.WithJobCSIVolume(spcName),
213212
utils.WithJobAnnotations(utils.BuildSecretProviderClassReloadAnnotation(spcName)))
214213
Expect(err).NotTo(HaveOccurred())

test/e2e/annotations/annotations_suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ var _ = BeforeSuite(func() {
4343

4444
registry = utils.NewAdapterRegistry(kubeClient)
4545

46-
// Register optional adapters if CRDs are installed
4746
if utils.IsArgoRolloutsInstalled(ctx, testEnv.RolloutsClient) {
4847
GinkgoWriter.Println("Argo Rollouts detected, registering ArgoRolloutAdapter")
4948
registry.RegisterAdapter(utils.NewArgoRolloutAdapter(testEnv.RolloutsClient))
@@ -60,7 +59,7 @@ var _ = BeforeSuite(func() {
6059

6160
deployValues := map[string]string{
6261
"reloader.reloadStrategy": "annotations",
63-
"reloader.watchGlobally": "false", // Only watch own namespace to prevent cross-talk between test suites
62+
"reloader.watchGlobally": "false",
6463
}
6564

6665
if utils.IsCSIDriverInstalled(ctx, csiClient) {

test/e2e/annotations/auto_reload_test.go

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -130,36 +130,7 @@ var _ = Describe("Auto Reload Annotation Tests", func() {
130130
})
131131
})
132132

133-
Context("with reloader.stakater.com/auto=false annotation", func() {
134-
It("should NOT reload Deployment when ConfigMap changes", func() {
135-
By("Creating a ConfigMap")
136-
_, err := utils.CreateConfigMap(ctx, kubeClient, testNamespace, configMapName,
137-
map[string]string{"key": "initial"}, nil)
138-
Expect(err).NotTo(HaveOccurred())
139-
140-
By("Creating a Deployment with auto=false annotation")
141-
_, err = utils.CreateDeployment(ctx, kubeClient, testNamespace, deploymentName,
142-
utils.WithConfigMapEnvFrom(configMapName),
143-
utils.WithAnnotations(utils.BuildAutoFalseAnnotation()),
144-
)
145-
Expect(err).NotTo(HaveOccurred())
146-
147-
By("Waiting for Deployment to be ready")
148-
err = adapter.WaitReady(ctx, testNamespace, deploymentName, utils.WorkloadReadyTimeout)
149-
Expect(err).NotTo(HaveOccurred())
150-
151-
By("Updating the ConfigMap data")
152-
err = utils.UpdateConfigMap(ctx, kubeClient, testNamespace, configMapName, map[string]string{"key": "updated"})
153-
Expect(err).NotTo(HaveOccurred())
154-
155-
By("Verifying Deployment is NOT reloaded (negative test)")
156-
time.Sleep(utils.NegativeTestWait)
157-
reloaded, err := adapter.WaitReloaded(ctx, testNamespace, deploymentName,
158-
utils.AnnotationLastReloadedFrom, utils.ShortTimeout)
159-
Expect(err).NotTo(HaveOccurred())
160-
Expect(reloaded).To(BeFalse(), "Deployment with auto=false should NOT have been reloaded")
161-
})
162-
})
133+
// Note: auto=false test is now in core/workloads_test.go as a DescribeTable for all workload types
163134

164135
Context("with configmap.reloader.stakater.com/auto=true annotation", func() {
165136
It("should reload Deployment only when ConfigMap changes, not Secret", func() {

test/e2e/annotations/combination_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ var _ = Describe("Combination Annotation Tests", func() {
4848

4949
By("Creating a Deployment with auto=true AND explicit reload annotation for extra ConfigMap")
5050
_, err = utils.CreateDeployment(ctx, kubeClient, testNamespace, deploymentName,
51-
utils.WithConfigMapEnvFrom(configMapName), // auto-detected
51+
utils.WithConfigMapEnvFrom(configMapName),
5252
utils.WithAnnotations(utils.MergeAnnotations(
5353
utils.BuildAutoTrueAnnotation(),
54-
utils.BuildConfigMapReloadAnnotation(configMapName2), // explicitly listed
54+
utils.BuildConfigMapReloadAnnotation(configMapName2),
5555
)),
5656
)
5757
Expect(err).NotTo(HaveOccurred())
@@ -82,10 +82,10 @@ var _ = Describe("Combination Annotation Tests", func() {
8282

8383
By("Creating a Deployment with auto=true AND explicit reload annotation for extra ConfigMap")
8484
_, err = utils.CreateDeployment(ctx, kubeClient, testNamespace, deploymentName,
85-
utils.WithConfigMapEnvFrom(configMapName), // auto-detected
85+
utils.WithConfigMapEnvFrom(configMapName),
8686
utils.WithAnnotations(utils.MergeAnnotations(
8787
utils.BuildAutoTrueAnnotation(),
88-
utils.BuildConfigMapReloadAnnotation(configMapName2), // explicitly listed
88+
utils.BuildConfigMapReloadAnnotation(configMapName2),
8989
)),
9090
)
9191
Expect(err).NotTo(HaveOccurred())
@@ -116,10 +116,10 @@ var _ = Describe("Combination Annotation Tests", func() {
116116

117117
By("Creating a Deployment with auto=true AND explicit reload annotation for extra Secret")
118118
_, err = utils.CreateDeployment(ctx, kubeClient, testNamespace, deploymentName,
119-
utils.WithSecretEnvFrom(secretName), // auto-detected
119+
utils.WithSecretEnvFrom(secretName),
120120
utils.WithAnnotations(utils.MergeAnnotations(
121121
utils.BuildAutoTrueAnnotation(),
122-
utils.BuildSecretReloadAnnotation(secretName2), // explicitly listed
122+
utils.BuildSecretReloadAnnotation(secretName2),
123123
)),
124124
)
125125
Expect(err).NotTo(HaveOccurred())
@@ -153,10 +153,10 @@ var _ = Describe("Combination Annotation Tests", func() {
153153
By("Creating a Deployment with auto=true AND exclude for second ConfigMap")
154154
_, err = utils.CreateDeployment(ctx, kubeClient, testNamespace, deploymentName,
155155
utils.WithConfigMapEnvFrom(configMapName),
156-
utils.WithConfigMapEnvFrom(configMapName2), // also mounted, but excluded
156+
utils.WithConfigMapEnvFrom(configMapName2),
157157
utils.WithAnnotations(utils.MergeAnnotations(
158158
utils.BuildAutoTrueAnnotation(),
159-
utils.BuildConfigMapExcludeAnnotation(configMapName2), // exclude this one
159+
utils.BuildConfigMapExcludeAnnotation(configMapName2),
160160
)),
161161
)
162162
Expect(err).NotTo(HaveOccurred())

test/e2e/annotations/exclude_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ var _ = Describe("Exclude Annotation Tests", func() {
357357
Expect(err).NotTo(HaveOccurred())
358358

359359
By("Finding the SPCPS for non-excluded SPC")
360-
// We need to find SPCPS for the non-excluded SPC (spcName2)
360+
361361
spcpsName2, err := utils.FindSPCPSForSPC(ctx, csiClient, testNamespace, spcName2, 30*time.Second)
362362
Expect(err).NotTo(HaveOccurred())
363363

test/e2e/annotations/search_match_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ var _ = Describe("Search and Match Annotation Tests", func() {
9898

9999
By("Creating a Deployment WITHOUT search annotation (only standard annotation)")
100100
_, err = utils.CreateDeployment(ctx, kubeClient, testNamespace, deploymentName,
101-
utils.WithConfigMapEnvFrom(configMapName),
102-
// Note: No search or reload annotation - deployment won't be affected by match
103-
)
101+
utils.WithConfigMapEnvFrom(configMapName))
104102
Expect(err).NotTo(HaveOccurred())
105103

106104
By("Waiting for Deployment to be ready")
@@ -141,7 +139,6 @@ var _ = Describe("Search and Match Annotation Tests", func() {
141139
By("Creating second Deployment WITHOUT search annotation")
142140
_, err = utils.CreateDeployment(ctx, kubeClient, testNamespace, deploymentName2,
143141
utils.WithConfigMapEnvFrom(configMapName),
144-
// No search annotation
145142
)
146143
Expect(err).NotTo(HaveOccurred())
147144

test/e2e/argo/rollout_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ var _ = Describe("Argo Rollout Strategy Tests", func() {
2929
_ = utils.DeleteConfigMap(ctx, kubeClient, testNamespace, configMapName)
3030
})
3131

32-
// Argo Rollouts have a special "restart" strategy that sets spec.restartAt field
33-
// instead of using pod template annotations. This is unique to Argo Rollouts.
3432
Context("Rollout strategy annotation", func() {
3533
It("should use default rollout strategy (annotation-based reload)", func() {
3634
By("Creating a ConfigMap")
@@ -67,7 +65,6 @@ var _ = Describe("Argo Rollout Strategy Tests", func() {
6765
Expect(err).NotTo(HaveOccurred())
6866

6967
By("Creating an Argo Rollout with restart strategy annotation")
70-
// Note: auto annotation goes on pod template, rollout-strategy goes on object metadata
7168
_, err = utils.CreateRollout(ctx, rolloutsClient, testNamespace, rolloutName,
7269
utils.WithRolloutConfigMapEnvFrom(configMapName),
7370
utils.WithRolloutAnnotations(utils.BuildAutoTrueAnnotation()),

test/e2e/core/core_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var _ = BeforeSuite(func() {
5959

6060
deployValues := map[string]string{
6161
"reloader.reloadStrategy": "annotations",
62-
"reloader.watchGlobally": "false", // Only watch own namespace to prevent cross-talk between test suites
62+
"reloader.watchGlobally": "false",
6363
}
6464

6565
if utils.IsArgoRolloutsInstalled(ctx, testEnv.RolloutsClient) {

0 commit comments

Comments
 (0)