mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: remove resources calls (#4344)
This commit is contained in:
@ -486,18 +486,22 @@ func AwaitWorkspaceBuildJob(t *testing.T, client *codersdk.Client, build uuid.UU
|
||||
}
|
||||
|
||||
// AwaitWorkspaceAgents waits for all resources with agents to be connected.
|
||||
func AwaitWorkspaceAgents(t *testing.T, client *codersdk.Client, build uuid.UUID) []codersdk.WorkspaceResource {
|
||||
func AwaitWorkspaceAgents(t *testing.T, client *codersdk.Client, workspaceID uuid.UUID) []codersdk.WorkspaceResource {
|
||||
t.Helper()
|
||||
|
||||
t.Logf("waiting for workspace agents (build %s)", build)
|
||||
t.Logf("waiting for workspace agents (workspace %s)", workspaceID)
|
||||
var resources []codersdk.WorkspaceResource
|
||||
require.Eventually(t, func() bool {
|
||||
var err error
|
||||
resources, err = client.WorkspaceResourcesByBuild(context.Background(), build)
|
||||
workspace, err := client.Workspace(context.Background(), workspaceID)
|
||||
if !assert.NoError(t, err) {
|
||||
return false
|
||||
}
|
||||
for _, resource := range resources {
|
||||
if workspace.LatestBuild.Job.CompletedAt.IsZero() {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, resource := range workspace.LatestBuild.Resources {
|
||||
for _, agent := range resource.Agents {
|
||||
if agent.Status != codersdk.WorkspaceAgentConnected {
|
||||
t.Logf("agent %s not connected yet", agent.Name)
|
||||
@ -505,6 +509,8 @@ func AwaitWorkspaceAgents(t *testing.T, client *codersdk.Client, build uuid.UUID
|
||||
}
|
||||
}
|
||||
}
|
||||
resources = workspace.LatestBuild.Resources
|
||||
|
||||
return true
|
||||
}, testutil.WaitLong, testutil.IntervalFast)
|
||||
return resources
|
||||
|
Reference in New Issue
Block a user