fix: coderdtest: increase ForceCancelInterval (#3085)

Two coderd unit tests (TestPatchCancelTemplateVersion/Success and TestPatchCancelWorkspaceBuild) 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.

Fixes #3083.
This commit is contained in:
Cian Johnston
2022-07-21 20:29:45 +01:00
committed by GitHub
parent e01905821f
commit 59b04c154e
3 changed files with 15 additions and 6 deletions

View File

@ -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"
@ -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)
}