Skip to content

Commit 595fd5d

Browse files
added ginkgo test to verify dex volume and volumeMounts (#963)
Signed-off-by: Alka Kumari <alkumari@redhat.com> Co-authored-by: Siddhesh Ghadi <61187612+svghadi@users.noreply.github.com>
1 parent edac947 commit 595fd5d

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

test/openshift/e2e/ginkgo/parallel/1-007_validate_volume_mounts_test.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,67 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
143143

144144
})
145145

146+
It("verifies that dex controller has the expected volumes and volumemounts, including custom volumes and volumemounts", func() {
147+
148+
By("creating new namespace-scoped Argo CD instance with dex enabled and custom volumes and volume mounts")
149+
randomNS, cleanupFunc = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc()
150+
151+
argoCDRandomNS := &argov1beta1api.ArgoCD{
152+
ObjectMeta: metav1.ObjectMeta{Name: "argocd", Namespace: randomNS.Name},
153+
Spec: argov1beta1api.ArgoCDSpec{
154+
SSO: &argov1beta1api.ArgoCDSSOSpec{
155+
Provider: argov1beta1api.SSOProviderTypeDex,
156+
Dex: &argov1beta1api.ArgoCDDexSpec{
157+
OpenShiftOAuth: true,
158+
Volumes: []corev1.Volume{
159+
{Name: "custom-dex-volume", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}},
160+
},
161+
VolumeMounts: []corev1.VolumeMount{
162+
{Name: "custom-dex-volume", MountPath: "/custom/dex"},
163+
},
164+
},
165+
},
166+
},
167+
}
168+
Expect(k8sClient.Create(ctx, argoCDRandomNS)).To(Succeed())
169+
170+
By("verifying Argo CD is available and Dex is running")
171+
Eventually(argoCDRandomNS, "5m", "5s").Should(argocdFixture.BeAvailable())
172+
173+
By("verifying dex server Deployment has the expected volume and volumemount values")
174+
dexServerDepl := appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-dex-server", Namespace: randomNS.Name}}
175+
176+
Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(&dexServerDepl), &dexServerDepl)).To(Succeed())
177+
178+
// Check that custom volume mounts are present
179+
Expect(dexServerDepl.Spec.Template.Spec.Containers[0].VolumeMounts).To(Equal([]corev1.VolumeMount{
180+
{Name: "static-files", MountPath: "/shared"},
181+
{Name: "dexconfig", MountPath: "/tmp"},
182+
{Name: "custom-dex-volume", MountPath: "/custom/dex"},
183+
}))
184+
185+
// Verify that the deployment has the expected volumes (including custom ones)
186+
Expect(dexServerDepl.Spec.Template.Spec.Volumes).To(Equal([]corev1.Volume{
187+
{
188+
Name: "static-files",
189+
VolumeSource: corev1.VolumeSource{
190+
EmptyDir: &corev1.EmptyDirVolumeSource{},
191+
},
192+
},
193+
{
194+
Name: "dexconfig",
195+
VolumeSource: corev1.VolumeSource{
196+
EmptyDir: &corev1.EmptyDirVolumeSource{},
197+
},
198+
},
199+
{
200+
Name: "custom-dex-volume",
201+
VolumeSource: corev1.VolumeSource{
202+
EmptyDir: &corev1.EmptyDirVolumeSource{},
203+
},
204+
},
205+
}))
206+
})
207+
146208
})
147209
})

0 commit comments

Comments
 (0)