@@ -138,6 +138,7 @@ func TestPostTemplateVersionsByOrganization(t *testing.T) {
138
138
require .Len (t , auditor .AuditLogs (), 2 )
139
139
assert .Equal (t , database .AuditActionCreate , auditor .AuditLogs ()[1 ].Action )
140
140
})
141
+
141
142
t .Run ("Example" , func (t * testing.T ) {
142
143
t .Parallel ()
143
144
client := coderdtest .New (t , nil )
@@ -1453,3 +1454,45 @@ func TestTemplateVersionPatch(t *testing.T) {
1453
1454
require .Error (t , err )
1454
1455
})
1455
1456
}
1457
+
1458
+ func TestTemplateVersionWarnings (t * testing.T ) {
1459
+ t .Parallel ()
1460
+
1461
+ client := coderdtest .New (t , & coderdtest.Options {IncludeProvisionerDaemon : true })
1462
+ user := coderdtest .CreateFirstUser (t , client )
1463
+
1464
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
1465
+ defer cancel ()
1466
+
1467
+ templateVersion := coderdtest .CreateTemplateVersion (t , client , user .OrganizationID , & echo.Responses {
1468
+ Parse : []* proto.Parse_Response {{
1469
+ Type : & proto.Parse_Response_Complete {
1470
+ Complete : & proto.Parse_Complete {
1471
+ ParameterSchemas : []* proto.ParameterSchema {
1472
+ {
1473
+ AllowOverrideSource : true ,
1474
+ Name : "example" ,
1475
+ Description : "description 1" ,
1476
+ DefaultSource : & proto.ParameterSource {
1477
+ Scheme : proto .ParameterSource_DATA ,
1478
+ Value : "tomato" ,
1479
+ },
1480
+ DefaultDestination : & proto.ParameterDestination {
1481
+ Scheme : proto .ParameterDestination_PROVISIONER_VARIABLE ,
1482
+ },
1483
+ },
1484
+ },
1485
+ },
1486
+ },
1487
+ }},
1488
+ ProvisionApply : echo .ProvisionComplete ,
1489
+ ProvisionPlan : echo .ProvisionComplete ,
1490
+ })
1491
+ coderdtest .AwaitTemplateVersionJob (t , client , templateVersion .ID )
1492
+ template := coderdtest .CreateTemplate (t , client , user .OrganizationID , templateVersion .ID )
1493
+
1494
+ templateVersion , err := client .TemplateVersion (ctx , template .ActiveVersionID )
1495
+ require .NoError (t , err )
1496
+
1497
+ require .Contains (t , templateVersion .Warnings , codersdk .TemplateVersionWarningDeprecatedParameters )
1498
+ }
0 commit comments