Skip to content
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

Merged
merged 16 commits into from
Sep 22, 2022

Conversation

Arvindthiru
Copy link
Contributor

@Arvindthiru Arvindthiru commented Sep 20, 2022

Description of your changes

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

@Arvindthiru Arvindthiru changed the title Move join/leave to Before/After Suites test: Move join/leave to Before/After Suites Sep 20, 2022
@Arvindthiru
Copy link
Contributor Author

Had to create a new suite for a test @ryanzhang-oss added which involves placement API before joining and after joining

@Arvindthiru
Copy link
Contributor Author

Only made changes/removed helper files used by join/leave workflow, other helper methods will be refactored in #286

@Arvindthiru Arvindthiru marked this pull request as ready for review September 21, 2022 02:17
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2eJoinLeavePlacement/join_leave_workload_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/join_leave_workload_test.go Outdated Show resolved Hide resolved
test/e2e/join_leave_workload_test.go Outdated Show resolved Hide resolved
test/e2e/join_leave_workload_test.go Outdated Show resolved Hide resolved
test/e2e/join_leave_workload_test.go Outdated Show resolved Hide resolved
test/e2e/join_leave_workload_test.go Outdated Show resolved Hide resolved
test/e2e/join_leave_member_test.go Outdated Show resolved Hide resolved
test/e2e/join_leave_member_test.go Show resolved Hide resolved
test/e2e/join_leave_member_test.go Outdated Show resolved Hide resolved
@Arvindthiru Arvindthiru marked this pull request as draft September 22, 2022 21:59
@Arvindthiru Arvindthiru marked this pull request as ready for review September 22, 2022 22:12
@ryanzhang-oss ryanzhang-oss merged commit b085bed into Azure:main Sep 22, 2022
Comment on lines +107 to +124
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)
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants