Skip to content

Commit 32e9a7b

Browse files
committed
add comment and stricter check
1 parent 026d40d commit 32e9a7b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

enterprise/coderd/templates_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,9 +1860,20 @@ func TestMultipleOrganizationTemplates(t *testing.T) {
18601860
t.Logf("Third organization: %s", third.ID.String())
18611861

18621862
t.Logf("Creating template version in second organization")
1863+
1864+
start := time.Now()
18631865
version := coderdtest.CreateTemplateVersion(t, templateAdmin, second.ID, nil)
18641866
coderdtest.AwaitTemplateVersionJobCompleted(t, ownerClient, version.ID)
18651867
coderdtest.CreateTemplate(t, templateAdmin, second.ID, version.ID, func(request *codersdk.CreateTemplateRequest) {
18661868
request.Name = "random"
18671869
})
1870+
1871+
if time.Since(start) > time.Second*10 {
1872+
// The test can sometimes pass because 'AwaitTemplateVersionJobCompleted'
1873+
// allows 25s, and the provisioner will check every 30s if not awakened
1874+
// from the pubsub. So there is a chance it will pass. If it takes longer
1875+
// than 10s, then it's a problem. The provisioner is not getting clearance.
1876+
t.Error("Creating template version in second organization took too long")
1877+
t.FailNow()
1878+
}
18681879
}

0 commit comments

Comments
 (0)