@@ -10,6 +10,7 @@ import (
10
10
"github.com/stretchr/testify/assert"
11
11
"github.com/stretchr/testify/require"
12
12
"golang.org/x/sync/errgroup"
13
+ "golang.org/x/xerrors"
13
14
14
15
"github.com/coder/coder/coderd/coderdtest"
15
16
"github.com/coder/coder/codersdk"
@@ -851,10 +852,22 @@ func TestPaginatedTemplateVersions(t *testing.T) {
851
852
})
852
853
}
853
854
err := eg .Wait ()
854
- require .NoError (t , err )
855
-
856
- for _ , id := range templateVersionIDs {
857
- _ = coderdtest .AwaitTemplateVersionJob (t , client , id )
855
+ require .NoError (t , err , "create templates failed" )
856
+
857
+ for i := 0 ; i < len (templateVersionIDs ); i ++ {
858
+ // We don't use coderdtest.AwaitTemplateVersionJob here because
859
+ // we can't control the timeouts, the concurrent creations take
860
+ // a while.
861
+ templateVersion , err := client .TemplateVersion (ctx , templateVersionIDs [i ])
862
+ if err == nil && templateVersion .Job .CompletedAt != nil {
863
+ break
864
+ }
865
+ if xerrors .Is (err , context .DeadlineExceeded ) {
866
+ require .NoError (t , err , "template version %d not created in time" , i )
867
+ }
868
+ // Retry.
869
+ time .Sleep (25 * time .Millisecond )
870
+ i --
858
871
}
859
872
860
873
templateVersions , err := client .TemplateVersionsByTemplate (ctx ,
0 commit comments