Skip to content

Commit

Permalink
make tests less fragile
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgb committed Mar 3, 2024
1 parent d497ce1 commit 7a5ef23
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hooks/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,15 @@ var _ = Describe("Namespace webhook", func() {
sub := &corev1.Namespace{}
sub.Name = "sub-of-non-circular-root"
sub.Labels = map[string]string{constants.LabelParent: "non-circular-root"}
Expect(k8sClient.Create(ctx, sub)).To(Succeed())
Eventually(k8sClient.Create(ctx, sub)).Should(Succeed())

sub2 := &corev1.Namespace{}
sub2.Name = "sub2-of-non-circular-root"
sub2.Labels = map[string]string{constants.LabelParent: "sub-of-non-circular-root"}
Expect(k8sClient.Create(ctx, sub2)).To(Succeed())
Eventually(k8sClient.Create(ctx, sub2)).Should(Succeed())

sub.Labels[constants.LabelParent] = "sub2-of-non-circular-root"
err := k8sClient.Update(ctx, sub)
Expect(err).To(HaveOccurred())
Consistently(k8sClient.Update(ctx, sub)).Should(HaveOccurred())
})

It("should deny updating a template namespace that would create a circular reference", func() {
Expand Down

0 comments on commit 7a5ef23

Please sign in to comment.