Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit897286f

Browse files
test: fix flake in scaletest/workspaceupdates/TestRun (#20773)
Closescoder/internal#1127In the workspace updates scaletest load generator, we end the test once all clients have seen a workspace update for their workspace. These workspace updates are generated when the workspace is created, NOT when the workspace build has finished. This means when the runner goes to clean up the workspaces, they may still be building. The runner attempts to address this by cancelling the build, but that fails with a 403 since the runner users don't have permission.The fix is to simply always wait for the build to finish, regardless of whether we were able to successfully cancel it.In this test it's probably faster to just wait for the build to finish then the overhead of cancelling it, so that's what I've gone with here.
1 parent5ee39e8 commit897286f

File tree

1 file changed

+5
-5
lines changed
  • scaletest/workspacebuild

1 file changed

+5
-5
lines changed

‎scaletest/workspacebuild/run.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ func (r *CleanupRunner) Run(ctx context.Context, _ string, logs io.Writer) error
147147
iferr==nil&&build.Job.Status.Active() {
148148
// mark the build as canceled
149149
logger.Info(ctx,"canceling workspace build",slog.F("build_id",build.ID),slog.F("workspace_id",r.workspaceID))
150-
iferr=r.client.CancelWorkspaceBuild(ctx,build.ID, codersdk.CancelWorkspaceBuildParams{});err==nil {
151-
// Wait for the job to cancel before we delete it
152-
_=waitForBuild(ctx,logs,r.client,build.ID)// it will return a "build canceled" error
153-
}else {
154-
logger.Warn(ctx,"failed to cancel workspace build, attempting to delete anyway",slog.Error(err))
150+
iferr=r.client.CancelWorkspaceBuild(ctx,build.ID, codersdk.CancelWorkspaceBuildParams{});err!=nil {
151+
logger.Warn(ctx,"failed to cancel workspace build",slog.Error(err))
155152
}
153+
// Wait for either the build or the cancellation to finish
154+
// either is necessary or we'll fail at the delete step.
155+
_=waitForBuild(ctx,logs,r.client,build.ID)// it will return a "build canceled" error
156156
}else {
157157
logger.Warn(ctx,"unable to lookup latest workspace build, attempting to delete anyway",slog.Error(err))
158158
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp