mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test: use explicit names in TestStartAutoUpdate to prevent flake (#21745)
The test was creating two template versions without explicit names, relying on `namesgenerator.NameDigitWith()` which can produce collisions. When both versions got the same random name, the test failed with a 409 Conflict error. Fix by giving each version an explicit name (`v1`, `v2`). Closes https://github.com/coder/internal/issues/1309 --- *Generated by [mux](https://mux.coder.com)*
This commit is contained in:
@@ -1486,7 +1486,9 @@ func TestWorkspaceAutobuild(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Create a template version1 that passes to get a functioning workspace.
|
||||
version1 := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil)
|
||||
version1 := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil, func(ctvr *codersdk.CreateTemplateVersionRequest) {
|
||||
ctvr.Name = "v1"
|
||||
})
|
||||
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version1.ID)
|
||||
|
||||
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version1.ID)
|
||||
@@ -1502,6 +1504,7 @@ func TestWorkspaceAutobuild(t *testing.T) {
|
||||
// Create a new version so that we can assert we don't update
|
||||
// to the latest by default.
|
||||
version2 := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil, func(ctvr *codersdk.CreateTemplateVersionRequest) {
|
||||
ctvr.Name = "v2"
|
||||
ctvr.TemplateID = template.ID
|
||||
})
|
||||
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version2.ID)
|
||||
|
||||
Reference in New Issue
Block a user