From 5ee69d2647bda0349a25b66343f599955edd9cdd Mon Sep 17 00:00:00 2001 From: 3u13r Date: Tue, 17 Jan 2023 11:32:39 +0100 Subject: [PATCH] operator: test JoiningNode in correct order (#988) --- .../joiningnode_controller_env_test.go | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/operators/constellation-node-operator/controllers/joiningnode_controller_env_test.go b/operators/constellation-node-operator/controllers/joiningnode_controller_env_test.go index eb1bc2097..d67b9258f 100644 --- a/operators/constellation-node-operator/controllers/joiningnode_controller_env_test.go +++ b/operators/constellation-node-operator/controllers/joiningnode_controller_env_test.go @@ -92,23 +92,6 @@ var _ = Describe("JoiningNode controller", func() { }) It("Should annotate the corresponding node when creating the node first", func() { ctx := context.Background() - By("creating a node") - node := &corev1.Node{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "update.edgeless.systems/v1alpha1", - Kind: "Node", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: nodeName2, - }, - Spec: corev1.NodeSpec{}, - } - Expect(k8sClient.Create(ctx, node)).Should(Succeed()) - createdNode := &corev1.Node{} - Eventually(func() error { - return k8sClient.Get(ctx, types.NamespacedName{Name: nodeName2}, createdNode) - }, timeout, interval).Should(Succeed()) - Expect(createdNode.ObjectMeta.Name).Should(Equal(nodeName2)) By("creating a joining node resource") joiningNode := &updatev1alpha1.JoiningNode{ @@ -132,6 +115,24 @@ var _ = Describe("JoiningNode controller", func() { Expect(createdJoiningNode.Spec.Name).Should(Equal(nodeName2)) Expect(createdJoiningNode.Spec.ComponentsReference).Should(Equal(ComponentsReference2)) + By("creating a node") + node := &corev1.Node{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "update.edgeless.systems/v1alpha1", + Kind: "Node", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: nodeName2, + }, + Spec: corev1.NodeSpec{}, + } + Expect(k8sClient.Create(ctx, node)).Should(Succeed()) + createdNode := &corev1.Node{} + Eventually(func() error { + return k8sClient.Get(ctx, types.NamespacedName{Name: nodeName2}, createdNode) + }, timeout, interval).Should(Succeed()) + Expect(createdNode.ObjectMeta.Name).Should(Equal(nodeName2)) + By("annotating the node") Eventually(func() string { _ = k8sClient.Get(ctx, types.NamespacedName{Name: createdNode.Name}, createdNode)