-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Move join/leave to Before/After Suites #303
Conversation
9807594
to
a81aeab
Compare
Had to create a new suite for a test @ryanzhang-oss added which involves placement API before joining and after joining |
Only made changes/removed helper files used by join/leave workflow, other helper methods will be refactored in #286 |
2a277ea
to
4440a10
Compare
Expect(HubCluster.KubeClient.Get(ctx, types.NamespacedName{Name: mc.Name}, mc)).Should(Succeed(), "Failed to retrieve member cluster %s in %s cluster", mc.Name, HubCluster.ClusterName) | ||
mc.Spec.State = v1alpha1.ClusterStateJoin | ||
Expect(HubCluster.KubeClient.Update(ctx, mc)).Should(Succeed(), "Failed to update member cluster %s in %s cluster", mc.Name, HubCluster.ClusterName) | ||
|
||
By("check if member cluster condition is updated to Joined") | ||
wantMCStatus = v1alpha1.MemberClusterStatus{ | ||
AgentStatus: imcJoinedAgentStatus, | ||
Conditions: mcJoinedConditions, | ||
} | ||
Eventually(func() error { | ||
if err := HubCluster.KubeClient.Get(ctx, types.NamespacedName{Name: mc.Name}, mc); err != nil { | ||
return err | ||
} | ||
if statusDiff := cmp.Diff(wantMCStatus, mc.Status, mcStatusCmpOptions...); statusDiff != "" { | ||
return fmt.Errorf("member cluster(%s) status mismatch (-want +got):\n%s", mc.Name, statusDiff) | ||
} | ||
return nil | ||
}, testutils.PollTimeout, testutils.PollInterval).Should(Succeed(), "Failed to wait for member cluster %s to have status %s", mc.Name, wantMCStatus) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could refactor it as the util, cause it's more like a setup. The whole test is to focus on validating the placement behavior.
Description of your changes
Fixes #
I have:
make reviewable
to ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer