Skip to content

Commit 06ae166

Browse files
committed
terminators: wait specifically for WST to be ready
On-behalf-of: SAP <[email protected]> Signed-off-by: Simon Bein <[email protected]>
1 parent d9a41be commit 06ae166

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

test/e2e/virtual/terminatingworkspaces/virtualworkspace_test.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ import (
5252
corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1"
5353
"github.com/kcp-dev/kcp/sdk/apis/tenancy/termination"
5454
tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1"
55+
conditionsv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/third_party/conditions/apis/conditions/v1alpha1"
5556
"github.com/kcp-dev/kcp/sdk/apis/third_party/conditions/util/conditions"
5657
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
5758
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
58-
kcptestinghelpers "github.com/kcp-dev/kcp/sdk/testing/helpers"
5959
"github.com/kcp-dev/kcp/test/e2e/framework"
6060
)
6161

@@ -157,12 +157,17 @@ func TestTerminatingWorkspacesVirtualWorkspaceAccess(t *testing.T) {
157157
})
158158
}
159159

160-
t.Log("Wait for WorkspaceTypes to have their type extensions resolved")
161-
for _, wst := range workspaceTypes {
162-
name := wst.Name
163-
kcptestinghelpers.EventuallyReady(t, func() (conditions.Getter, error) {
164-
return sourceKcpClusterClient.TenancyV1alpha1().Cluster(wsPath).WorkspaceTypes().Get(ctx, name, metav1.GetOptions{})
165-
}, "could not wait for readiness on WorkspaceType %s|%s", wsPath.String(), name)
160+
t.Log("Wait for WorkspaceTypes and their virtual workspace URLs to be ready")
161+
for name, wst := range workspaceTypes {
162+
wt := &tenancyv1alpha1.WorkspaceType{}
163+
require.EventuallyWithT(t, func(c *assert.CollectT) {
164+
wt, err = sourceKcpClusterClient.TenancyV1alpha1().Cluster(wsPath).WorkspaceTypes().Get(ctx, wst.Name, metav1.GetOptions{})
165+
require.NoError(c, err)
166+
require.NotEmpty(c, wt.Status.VirtualWorkspaces)
167+
require.True(c, conditions.IsTrue(wt, tenancyv1alpha1.WorkspaceTypeVirtualWorkspaceURLsReady))
168+
require.True(c, conditions.IsTrue(wt, conditionsv1alpha1.ReadyCondition))
169+
}, wait.ForeverTestTimeout, 100*time.Millisecond)
170+
workspaceTypes[name] = wt
166171
}
167172

168173
t.Log("Create workspaces using the new types")
@@ -544,13 +549,15 @@ func TestTerminatingWorkspacesVirtualWorkspaceWatch(t *testing.T) {
544549
})
545550
}
546551

547-
t.Log("Wait for WorkspaceTypes to have their type extensions resolved and vw URLs published")
552+
t.Log("Wait for WorkspaceTypes and their virtual workspace URLs to be ready")
548553
for name, wst := range workspaceTypes {
549554
wt := &tenancyv1alpha1.WorkspaceType{}
550555
require.EventuallyWithT(t, func(c *assert.CollectT) {
551556
wt, err = sourceKcpClusterClient.TenancyV1alpha1().Cluster(wsPath).WorkspaceTypes().Get(ctx, wst.Name, metav1.GetOptions{})
552557
require.NoError(c, err)
553558
require.NotEmpty(c, wt.Status.VirtualWorkspaces)
559+
require.True(c, conditions.IsTrue(wt, tenancyv1alpha1.WorkspaceTypeVirtualWorkspaceURLsReady))
560+
require.True(c, conditions.IsTrue(wt, conditionsv1alpha1.ReadyCondition))
554561
}, wait.ForeverTestTimeout, 100*time.Millisecond)
555562
workspaceTypes[name] = wt
556563
}

0 commit comments

Comments
 (0)