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

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedJul 21, 2022
edited
Loading

Twocoderd unit tests (TestPatchCancelTemplateVersion/Success andTestPatchCancelWorkspaceBuild) implied erroneously that the job was canceled successfully.

This is not the case, as these unit tests do not include a Provision_Complete response in the input to the
echo provisioner. Now explicitly checking the job error and bumping the force cancel interval to be longer.

I'm not sure if this is the "correct" fix here; I'm mainly unblocking#3061.
It seems that the "right" way would be to allow some way of modifying the contents of the test provisioner's job in-flight.
For example in this use-case, we want to have the job initially returning only logs (implying in progress), and then also returning a complete after we cancel.
There's another use case where we want the status quo, e.g. to test the force cancelation logic.

Fixes#3083.

Two unit tests (TestPatchCancelTemplateVersion/Success and Test-PatchCancelWorkspaceBuild) implied errneously that the job wascanceled successfully. This is not the case, as these unit testsdo not include a Provision_Complete response in the input to theecho provisioner. Now explicitly checking the job error.
@johnstcnjohnstcn self-assigned thisJul 21, 2022
@johnstcnjohnstcn changed the titlefix: coderd: TestPatchCancelTemplateVersion: check job errorfix: coderdtest: increase ForceCancelIntervalJul 21, 2022
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

As far as workarounds go, this looks OK to me. I'd like to defer to@spikecurtis for a correctness check though.

@@ -150,8 +150,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.

Copy link
Member

@Kira-PilotKira-Pilot left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this!

// 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
@johnstcnjohnstcnenabled auto-merge (squash)July 21, 2022 19:19
@johnstcnjohnstcn merged commit59b04c1 intomainJul 21, 2022
@johnstcnjohnstcn deleted the cj/gh-3083/test-cancel-provisionerjob-timeout branchJuly 21, 2022 19:29
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mafredrimafredrimafredri approved these changes

@spikecurtisspikecurtisspikecurtis approved these changes

@Kira-PilotKira-PilotKira-Pilot approved these changes

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

test bug: coderd/TestPatchCancelTemplateVersion/Success
4 participants
@johnstcn@mafredri@spikecurtis@Kira-Pilot

[8]ページ先頭

©2009-2025 Movatter.jp