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:
@@ -1977,10 +1977,13 @@ func TestTemplateVersionPatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
client := coderdtest.New(t, nil)
|
||||
user := coderdtest.CreateFirstUser(t, client)
|
||||
version1 := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil)
|
||||
version1 := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil, func(ctvr *codersdk.CreateTemplateVersionRequest) {
|
||||
ctvr.Name = "v1"
|
||||
})
|
||||
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version1.ID)
|
||||
|
||||
version2 := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil, func(ctvr *codersdk.CreateTemplateVersionRequest) {
|
||||
ctvr.Name = "v2"
|
||||
ctvr.TemplateID = template.ID
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user