Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion test/e2e/work_api_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import (
"k8s.io/apimachinery/pkg/types"
workapi "sigs.k8s.io/work-api/pkg/apis/v1alpha1"

"go.goms.io/fleet/apis/v1alpha1"
"go.goms.io/fleet/pkg/utils"
testutils "go.goms.io/fleet/test/e2e/utils"
)

// TODO: enable this when join/leave logic is connected to work-api, join the Hub and Member for this test.
var _ = XDescribe("Work API Controller test", func() {
var _ = Describe("Work API Controller test", func() {

const (
conditionTypeApplied = "Applied"
Expand All @@ -29,6 +30,9 @@ var _ = XDescribe("Work API Controller test", func() {
var (
ctx context.Context

// These variables are used to join the member cluster.
mc *v1alpha1.MemberCluster

// Includes all works applied to the hub cluster. Used for garbage collection.
works []workapi.Work

Expand All @@ -51,12 +55,22 @@ var _ = XDescribe("Work API Controller test", func() {
resourceNamespace = testutils.NewNamespace(resourceNamespaceName)
testutils.CreateNamespace(*MemberCluster, resourceNamespace)

// Member Cluster must join the fleet for Work API to work.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed with @ryanzhang-oss.

Let's make sure join member cluster in BeforeSuite and delete it in AfterSuite.

As the result, please remove join_leave_member_test.go as join/leave has been covered in the Before/After Suite.

cc @Arvindthiru

By("deploy member cluster in the hub cluster")
mc = testutils.NewMemberCluster(MemberCluster.ClusterName, 60, v1alpha1.ClusterStateJoin)
testutils.CreateMemberCluster(*HubCluster, mc)

By("check if member cluster condition is updated to Joined")
testutils.WaitConditionMemberCluster(*HubCluster, mc, v1alpha1.ConditionTypeMemberClusterJoined, metav1.ConditionTrue, testutils.PollTimeout)

//Empties the works since they were garbage collected earlier.
works = []workapi.Work{}
})

AfterEach(func() {
testutils.DeleteWork(ctx, *HubCluster, works)
testutils.DeleteMemberCluster(ctx, *HubCluster, mc)

testutils.DeleteNamespace(*MemberCluster, resourceNamespace)
})

Expand Down