@@ -525,6 +525,9 @@ func TestPatchTemplateMeta(t *testing.T) {
525
525
user := coderdtest .CreateFirstUser (t , client )
526
526
version := coderdtest .CreateTemplateVersion (t , client , user .OrganizationID , nil )
527
527
template := coderdtest .CreateTemplate (t , client , user .OrganizationID , version .ID )
528
+ // It is unfortunate we need to sleep, but the test can fail if the
529
+ // updatedAt is too close together.
530
+ time .Sleep (time .Millisecond * 5 )
528
531
529
532
req := codersdk.UpdateTemplateMeta {
530
533
DeprecationMessage : ptr .Ref ("APGL cannot deprecate" ),
@@ -550,6 +553,9 @@ func TestPatchTemplateMeta(t *testing.T) {
550
553
client , tplAdmin := coderdtest .CreateAnotherUser (t , owner , user .OrganizationID , rbac .RoleTemplateAdmin ())
551
554
version := coderdtest .CreateTemplateVersion (t , client , user .OrganizationID , nil )
552
555
template := coderdtest .CreateTemplate (t , client , user .OrganizationID , version .ID )
556
+ // It is unfortunate we need to sleep, but the test can fail if the
557
+ // updatedAt is too close together.
558
+ time .Sleep (time .Millisecond * 5 )
553
559
554
560
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
555
561
defer cancel ()
@@ -587,6 +593,10 @@ func TestPatchTemplateMeta(t *testing.T) {
587
593
template := coderdtest .CreateTemplate (t , client , user .OrganizationID , version .ID , func (ctr * codersdk.CreateTemplateRequest ) {
588
594
ctr .DefaultTTLMillis = ptr .Ref (24 * time .Hour .Milliseconds ())
589
595
})
596
+ // It is unfortunate we need to sleep, but the test can fail if the
597
+ // updatedAt is too close together.
598
+ time .Sleep (time .Millisecond * 5 )
599
+
590
600
req := codersdk.UpdateTemplateMeta {
591
601
DefaultTTLMillis : 0 ,
592
602
}
@@ -618,6 +628,10 @@ func TestPatchTemplateMeta(t *testing.T) {
618
628
template := coderdtest .CreateTemplate (t , client , user .OrganizationID , version .ID , func (ctr * codersdk.CreateTemplateRequest ) {
619
629
ctr .DefaultTTLMillis = ptr .Ref (24 * time .Hour .Milliseconds ())
620
630
})
631
+ // It is unfortunate we need to sleep, but the test can fail if the
632
+ // updatedAt is too close together.
633
+ time .Sleep (time .Millisecond * 5 )
634
+
621
635
req := codersdk.UpdateTemplateMeta {
622
636
DefaultTTLMillis : - 1 ,
623
637
}
0 commit comments