@@ -329,6 +329,32 @@ func TestPatchTemplateMeta(t *testing.T) {
329
329
assert .Equal (t , req .MinAutostartIntervalMillis , updated .MinAutostartIntervalMillis )
330
330
})
331
331
332
+ t .Run ("NoMaxTTL" , func (t * testing.T ) {
333
+ t .Parallel ()
334
+
335
+ client := coderdtest .New (t , nil )
336
+ user := coderdtest .CreateFirstUser (t , client )
337
+ version := coderdtest .CreateTemplateVersion (t , client , user .OrganizationID , nil )
338
+ template := coderdtest .CreateTemplate (t , client , user .OrganizationID , version .ID , func (ctr * codersdk.CreateTemplateRequest ) {
339
+ ctr .MaxTTLMillis = ptr .Ref (24 * time .Hour .Milliseconds ())
340
+ })
341
+ req := codersdk.UpdateTemplateMeta {
342
+ MaxTTLMillis : 0 ,
343
+ }
344
+
345
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
346
+ defer cancel ()
347
+
348
+ _ , err := client .UpdateTemplateMeta (ctx , template .ID , req )
349
+ require .NoError (t , err )
350
+
351
+ // Extra paranoid: did it _really_ happen?
352
+ updated , err := client .Template (ctx , template .ID )
353
+ require .NoError (t , err )
354
+ assert .Greater (t , updated .UpdatedAt , template .UpdatedAt )
355
+ assert .Equal (t , req .MaxTTLMillis , updated .MaxTTLMillis )
356
+ })
357
+
332
358
t .Run ("MaxTTLTooLow" , func (t * testing.T ) {
333
359
t .Parallel ()
334
360
0 commit comments