@@ -49,10 +49,10 @@ import (
4949 corev1alpha1 "github.com/kcp-dev/sdk/apis/core/v1alpha1"
5050 "github.com/kcp-dev/sdk/apis/tenancy/termination"
5151 tenancyv1alpha1 "github.com/kcp-dev/sdk/apis/tenancy/v1alpha1"
52+ conditionsv1alpha1 "github.com/kcp-dev/sdk/apis/third_party/conditions/apis/conditions/v1alpha1"
5253 "github.com/kcp-dev/sdk/apis/third_party/conditions/util/conditions"
5354 kcpclientset "github.com/kcp-dev/sdk/client/clientset/versioned/cluster"
5455 kcptesting "github.com/kcp-dev/sdk/testing"
55- kcptestinghelpers "github.com/kcp-dev/sdk/testing/helpers"
5656
5757 "github.com/kcp-dev/kcp/cmd/virtual-workspaces/options"
5858 "github.com/kcp-dev/kcp/pkg/virtual/terminatingworkspaces"
@@ -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