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

fix: coderdtest: increase ForceCancelInterval#3085

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

Merged
johnstcn merged 2 commits intomainfromcj/gh-3083/test-cancel-provisionerjob-timeout
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletioncoderd/coderdtest/coderdtest.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,7 +230,7 @@ func NewProvisionerDaemon(t *testing.T, coderAPI *coderd.API) io.Closer {
Logger: slogtest.Make(t, nil).Named("provisionerd").Leveled(slog.LevelDebug),
PollInterval: 10 * time.Millisecond,
UpdateInterval: 25 * time.Millisecond,
ForceCancelInterval:25 *time.Millisecond,
ForceCancelInterval: time.Second,
Provisioners: provisionerd.Provisioners{
string(database.ProvisionerTypeEcho): proto.NewDRPCProvisionerClient(provisionersdk.Conn(echoClient)),
},
Expand Down
11 changes: 8 additions & 3 deletionscoderd/templateversions_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,7 +126,9 @@ func TestPatchCancelTemplateVersion(t *testing.T) {
require.ErrorAs(t, err, &apiErr)
require.Equal(t, http.StatusPreconditionFailed, apiErr.StatusCode())
})
t.Run("Success", func(t *testing.T) {
// TODO(Cian): until we are able to test cancellation properly, validating
// Running -> Canceling is the best we can do for now.
t.Run("Canceling", func(t *testing.T) {
t.Parallel()
client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerD: true})
user := coderdtest.CreateFirstUser(t, client)
Expand All@@ -150,8 +152,11 @@ func TestPatchCancelTemplateVersion(t *testing.T) {
require.Eventually(t, func() bool {
var err error
version, err = client.TemplateVersion(context.Background(), version.ID)
require.NoError(t, err)
return version.Job.Status == codersdk.ProvisionerJobCanceled
return assert.NoError(t, err) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oh nice, TIL these could be used as booleans.

// The job will never actually cancel successfully because it will never send a
// provision complete response.
assert.Empty(t, version.Job.Error) &&
version.Job.Status == codersdk.ProvisionerJobCanceling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is fine with me as a workaround for now, but it exposes that we don't have any tests that actually reachJobCanceled. For that we need to either enhance the echo provisioner, or make a new provisioner that just waits until it is canceled and returns a successful cancel.

One thing that's probably worth doing is renaming this testcase Success -> Canceling to reflect the fact that we don't have a Success testcase yet.

johnstcn reacted with thumbs up emoji
}, 5*time.Second, 25*time.Millisecond)
})
}
Expand Down
8 changes: 6 additions & 2 deletionscoderd/workspacebuilds_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@ import (
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/coder/coder/coderd/coderdtest"
Expand DownExpand Up@@ -228,8 +229,11 @@ func TestPatchCancelWorkspaceBuild(t *testing.T) {
require.Eventually(t, func() bool {
var err error
build, err = client.WorkspaceBuild(context.Background(), build.ID)
require.NoError(t, err)
return build.Job.Status == codersdk.ProvisionerJobCanceled
return assert.NoError(t, err) &&
// The job will never actually cancel successfully because it will never send a
// provision complete response.
assert.Empty(t, build.Job.Error) &&
build.Job.Status == codersdk.ProvisionerJobCanceling
}, 5*time.Second, 25*time.Millisecond)
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp