-
Notifications
You must be signed in to change notification settings - Fork 887
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Two unit tests (TestPatchCancelTemplateVersion/Success and Test- PatchCancelWorkspaceBuild) implied errneously 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.
There was a problem hiding this 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) && |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 reach JobCanceled
. 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.
Two
coderd
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.