Skip to content

Commit

Permalink
satellite: add test for ktls-utils
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Wanzenböck <[email protected]>
  • Loading branch information
WanzenBug authored and JoelColledge committed Oct 31, 2023
1 parent 8538cf0 commit 53743da
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions internal/controller/linstorsatellite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,29 @@ var _ = Describe("LinstorSatelliteReconciler", func() {
}, DefaultTimeout, DefaultCheckInterval).Should(Succeed())
})

It("should create pod with ktls-utils if enabled", func(ctx context.Context) {
err := k8sClient.Patch(ctx, &piraeusiov1.LinstorSatellite{
TypeMeta: TypeMeta,
ObjectMeta: metav1.ObjectMeta{Name: ExampleNodeName},
Spec: piraeusiov1.LinstorSatelliteSpec{
InternalTLS: &piraeusiov1.TLSConfigWithHandshakeDaemon{
TLSHandshakeDaemon: true,
},
},
}, client.Apply, client.FieldOwner("test"))
Expect(err).NotTo(HaveOccurred())

Eventually(func(g Gomega) {
var pod corev1.Pod
err := k8sClient.Get(ctx, types.NamespacedName{Namespace: Namespace, Name: ExampleNodeName}, &pod)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(pod.Spec.Volumes).To(ContainElement(HaveField("Secret.SecretName", ExampleNodeName+"-tls")))
container := GetContainer(pod.Spec.Containers, "ktls-utils")
g.Expect(container).NotTo(BeNil())
g.Expect(container.VolumeMounts).To(ContainElement(HaveField("Name", "internal-tls")))
}, DefaultTimeout, DefaultCheckInterval).Should(Succeed())
})

It("should mount host directory for file storage", func(ctx context.Context) {
err := k8sClient.Patch(ctx, &piraeusiov1.LinstorSatellite{
TypeMeta: TypeMeta,
Expand Down

0 comments on commit 53743da

Please sign in to comment.