Skip to content

Commit

Permalink
operator: test JoiningNode in correct order (#988)
Browse files Browse the repository at this point in the history
  • Loading branch information
3u13r authored Jan 17, 2023
1 parent 9023482 commit 5ee69d2
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand Down

0 comments on commit 5ee69d2

Please sign in to comment.