Skip to content

Commit

Permalink
remove client CA tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pothulapati committed Oct 9, 2023
1 parent 4c6d90c commit 589fe4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 44 deletions.
49 changes: 5 additions & 44 deletions e2e/dragonfly_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ var _ = Describe("Dragonfly Lifecycle tests", Ordered, func() {
},
Key: "password",
},
ClientCaCertSecret: &corev1.SecretReference{
Name: "df-client-ca-certs",
},
},
Affinity: &corev1.Affinity{
NodeAffinity: &corev1.NodeAffinity{
Expand All @@ -110,25 +107,14 @@ var _ = Describe("Dragonfly Lifecycle tests", Ordered, func() {
Context("Dragonfly resource creation", func() {
It("Should create successfully", func() {
// create the secret
password := "df-pass-1"
err := k8sClient.Create(ctx, &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "df-client-ca-certs",
Namespace: namespace,
},
StringData: map[string]string{
"ca.crt": "foo",
},
})
Expect(err).To(BeNil())

// create the secret
err = k8sClient.Create(ctx, &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "df-secret",
Namespace: namespace,
},
StringData: map[string]string{
"password": "df-pass-1",
"password": password,
},
})
Expect(err).To(BeNil())
Expand Down Expand Up @@ -193,25 +179,9 @@ var _ = Describe("Dragonfly Lifecycle tests", Ordered, func() {
},
}))

// ClientCACertSecret
Expect(ss.Spec.Template.Spec.Containers[0].Args).To(ContainElement(fmt.Sprintf("%s=%s", resources.TLSCACertDirArg, resources.TLSCACertDir)))
Expect(ss.Spec.Template.Spec.Containers[0].VolumeMounts).To(ContainElement(corev1.VolumeMount{
Name: resources.TLSCACertVolumeName,
MountPath: resources.TLSCACertDir,
}))
Expect(ss.Spec.Template.Spec.Volumes).To(ContainElement(corev1.Volume{
Name: resources.TLSCACertVolumeName,
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: df.Spec.Authentication.ClientCaCertSecret.Name,
DefaultMode: func() *int32 { i := int32(420); return &i }(),
},
},
}))

// check for ping
stopChan := make(chan struct{}, 1)
_, err = checkAndK8sPortForwardRedis(ctx, stopChan, name, namespace, "df-pass-1")
defer close(stopChan)
_, err = checkAndK8sPortForwardRedis(ctx, stopChan, name, namespace, password)
Expect(err).To(BeNil())

})
Expand Down Expand Up @@ -587,7 +557,7 @@ var _ = Describe("Dragonfly PVC Test with single replica", Ordered, func() {
})
})

var _ = Describe("Dragonfly TLS tests", Ordered, func() {
var _ = Describe("Dragonfly Server TLS tests", Ordered, func() {
ctx := context.Background()
name := "df-tls"
namespace := "default"
Expand All @@ -604,15 +574,6 @@ var _ = Describe("Dragonfly TLS tests", Ordered, func() {
Spec: dragonflydbiov1alpha1.DragonflySpec{
Replicas: 2,
Args: args,
Env: []corev1.EnvVar{
{
Name: "DFLY_PASSWORD",
Value: "df-pass-1",
},
},
TLSSecretRef: &corev1.SecretReference{
Name: "df-tls",
},
},
}

Expand Down
4 changes: 4 additions & 0 deletions e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func checkAndK8sPortForwardRedis(ctx context.Context, stopChan chan struct{}, na
return nil, err
}

if len(pods.Items) == 0 {
return nil, fmt.Errorf("no pods found")
}

var master *corev1.Pod
for _, pod := range pods.Items {
if pod.Labels[resources.Role] == resources.Master {
Expand Down

0 comments on commit 589fe4d

Please sign in to comment.