- Notifications
You must be signed in to change notification settings - Fork1.1k
chore(scaletest): avoid polling workspace builds during workspace-updates tests#20534
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -33,8 +33,13 @@ func NewRunner(client *codersdk.Client, cfg Config) *Runner { | ||
| } | ||
| } | ||
| type SlimWorkspace struct { | ||
| ID uuid.UUID | ||
| Name string | ||
| } | ||
Comment on lines +36 to +39 MemberAuthor
| ||
| // Run implements Runnable. | ||
| func (r *Runner) RunReturningWorkspace(ctx context.Context, id string, logs io.Writer) (SlimWorkspace, error) { | ||
| ctx, span := tracing.StartSpan(ctx) | ||
| defer span.End() | ||
| @@ -47,14 +52,14 @@ func (r *Runner) RunReturningWorkspace(ctx context.Context, id string, logs io.W | ||
| if req.Name == "" { | ||
| randName, err := loadtestutil.GenerateWorkspaceName(id) | ||
| if err != nil { | ||
| returnSlimWorkspace{}, xerrors.Errorf("generate random name for workspace: %w", err) | ||
| } | ||
| req.Name = randName | ||
| } | ||
| workspace, err := r.client.CreateWorkspace(ctx, r.cfg.OrganizationID, r.cfg.UserID, req) | ||
| if err != nil { | ||
| returnSlimWorkspace{}, xerrors.Errorf("create workspace: %w", err) | ||
| } | ||
| r.workspaceID = workspace.ID | ||
| @@ -72,15 +77,15 @@ func (r *Runner) RunReturningWorkspace(ctx context.Context, id string, logs io.W | ||
| TemplateVersionID: req.TemplateVersionID, | ||
| }) | ||
| if err != nil { | ||
| returnSlimWorkspace{}, xerrors.Errorf("create workspace build: %w", err) | ||
| } | ||
| err = waitForBuild(ctx, logs, r.client, workspace.LatestBuild.ID) | ||
| if err == nil { | ||
| break | ||
| } | ||
| } | ||
| if err != nil { | ||
| returnSlimWorkspace{}, xerrors.Errorf("wait for build: %w", err) | ||
| } | ||
| } | ||
| } | ||
| @@ -91,16 +96,13 @@ func (r *Runner) RunReturningWorkspace(ctx context.Context, id string, logs io.W | ||
| _, _ = fmt.Fprintln(logs, "") | ||
| err = waitForAgents(ctx, logs, r.client, workspace.ID) | ||
| if err != nil { | ||
| returnSlimWorkspace{}, xerrors.Errorf("wait for agent: %w", err) | ||
| } | ||
| } | ||
| // Some users of this runner might not need the full workspace, and | ||
| // want to avoid querying the workspace. | ||
| return SlimWorkspace{ID: workspace.ID, Name: workspace.Name}, nil | ||
| } | ||
| // CleanupRunner is a runner that deletes a workspace in the Run phase. | ||
Uh oh!
There was an error while loading.Please reload this page.