@@ -191,65 +191,6 @@ func TestGetManifest(t *testing.T) {
191
191
// These are done manually to ensure the conversion logic matches what a
192
192
// human expects.
193
193
var (
194
- protoApps = []* agentproto.WorkspaceApp {
195
- {
196
- Id :apps [0 ].ID [:],
197
- Url :apps [0 ].Url .String ,
198
- External :apps [0 ].External ,
199
- Slug :apps [0 ].Slug ,
200
- DisplayName :apps [0 ].DisplayName ,
201
- Command :apps [0 ].Command .String ,
202
- Icon :apps [0 ].Icon ,
203
- Subdomain :apps [0 ].Subdomain ,
204
- SubdomainName :fmt .Sprintf ("%s--%s--%s--%s" ,apps [0 ].Slug ,agent .Name ,workspace .Name ,owner .Username ),
205
- SharingLevel :agentproto .WorkspaceApp_AUTHENTICATED ,
206
- Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
207
- Url :apps [0 ].HealthcheckUrl ,
208
- Interval :durationpb .New (time .Duration (apps [0 ].HealthcheckInterval )* time .Second ),
209
- Threshold :apps [0 ].HealthcheckThreshold ,
210
- },
211
- Health :agentproto .WorkspaceApp_HEALTHY ,
212
- Hidden :false ,
213
- },
214
- {
215
- Id :apps [1 ].ID [:],
216
- Url :apps [1 ].Url .String ,
217
- External :apps [1 ].External ,
218
- Slug :apps [1 ].Slug ,
219
- DisplayName :apps [1 ].DisplayName ,
220
- Command :apps [1 ].Command .String ,
221
- Icon :apps [1 ].Icon ,
222
- Subdomain :false ,
223
- SubdomainName :"" ,
224
- SharingLevel :agentproto .WorkspaceApp_PUBLIC ,
225
- Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
226
- Url :"" ,
227
- Interval :durationpb .New (0 ),
228
- Threshold :0 ,
229
- },
230
- Health :agentproto .WorkspaceApp_DISABLED ,
231
- Hidden :false ,
232
- },
233
- {
234
- Id :apps [2 ].ID [:],
235
- Url :apps [2 ].Url .String ,
236
- External :apps [2 ].External ,
237
- Slug :apps [2 ].Slug ,
238
- DisplayName :apps [2 ].DisplayName ,
239
- Command :apps [2 ].Command .String ,
240
- Icon :apps [2 ].Icon ,
241
- Subdomain :false ,
242
- SubdomainName :"" ,
243
- SharingLevel :agentproto .WorkspaceApp_OWNER ,
244
- Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
245
- Url :apps [2 ].HealthcheckUrl ,
246
- Interval :durationpb .New (time .Duration (apps [2 ].HealthcheckInterval )* time .Second ),
247
- Threshold :apps [2 ].HealthcheckThreshold ,
248
- },
249
- Health :agentproto .WorkspaceApp_UNHEALTHY ,
250
- Hidden :true ,
251
- },
252
- }
253
194
protoScripts = []* agentproto.WorkspaceAgentScript {
254
195
{
255
196
Id :scripts [0 ].ID [:],
@@ -308,6 +249,66 @@ func TestGetManifest(t *testing.T) {
308
249
t .Run ("OK" ,func (t * testing.T ) {
309
250
t .Parallel ()
310
251
252
+ protoApps := []* agentproto.WorkspaceApp {
253
+ {
254
+ Id :apps [0 ].ID [:],
255
+ Url :apps [0 ].Url .String ,
256
+ External :apps [0 ].External ,
257
+ Slug :apps [0 ].Slug ,
258
+ DisplayName :apps [0 ].DisplayName ,
259
+ Command :apps [0 ].Command .String ,
260
+ Icon :apps [0 ].Icon ,
261
+ Subdomain :apps [0 ].Subdomain ,
262
+ SubdomainName :fmt .Sprintf ("%s--%s--%s" ,apps [0 ].Slug ,workspace .Name ,owner .Username ),
263
+ SharingLevel :agentproto .WorkspaceApp_AUTHENTICATED ,
264
+ Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
265
+ Url :apps [0 ].HealthcheckUrl ,
266
+ Interval :durationpb .New (time .Duration (apps [0 ].HealthcheckInterval )* time .Second ),
267
+ Threshold :apps [0 ].HealthcheckThreshold ,
268
+ },
269
+ Health :agentproto .WorkspaceApp_HEALTHY ,
270
+ Hidden :false ,
271
+ },
272
+ {
273
+ Id :apps [1 ].ID [:],
274
+ Url :apps [1 ].Url .String ,
275
+ External :apps [1 ].External ,
276
+ Slug :apps [1 ].Slug ,
277
+ DisplayName :apps [1 ].DisplayName ,
278
+ Command :apps [1 ].Command .String ,
279
+ Icon :apps [1 ].Icon ,
280
+ Subdomain :false ,
281
+ SubdomainName :"" ,
282
+ SharingLevel :agentproto .WorkspaceApp_PUBLIC ,
283
+ Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
284
+ Url :"" ,
285
+ Interval :durationpb .New (0 ),
286
+ Threshold :0 ,
287
+ },
288
+ Health :agentproto .WorkspaceApp_DISABLED ,
289
+ Hidden :false ,
290
+ },
291
+ {
292
+ Id :apps [2 ].ID [:],
293
+ Url :apps [2 ].Url .String ,
294
+ External :apps [2 ].External ,
295
+ Slug :apps [2 ].Slug ,
296
+ DisplayName :apps [2 ].DisplayName ,
297
+ Command :apps [2 ].Command .String ,
298
+ Icon :apps [2 ].Icon ,
299
+ Subdomain :false ,
300
+ SubdomainName :"" ,
301
+ SharingLevel :agentproto .WorkspaceApp_OWNER ,
302
+ Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
303
+ Url :apps [2 ].HealthcheckUrl ,
304
+ Interval :durationpb .New (time .Duration (apps [2 ].HealthcheckInterval )* time .Second ),
305
+ Threshold :apps [2 ].HealthcheckThreshold ,
306
+ },
307
+ Health :agentproto .WorkspaceApp_UNHEALTHY ,
308
+ Hidden :true ,
309
+ },
310
+ }
311
+
311
312
mDB := dbmock .NewMockStore (gomock .NewController (t ))
312
313
313
314
api := & agentapi.ManifestAPI {
@@ -438,6 +439,66 @@ func TestGetManifest(t *testing.T) {
438
439
t .Run ("NoAppHostname" ,func (t * testing.T ) {
439
440
t .Parallel ()
440
441
442
+ protoApps := []* agentproto.WorkspaceApp {
443
+ {
444
+ Id :apps [0 ].ID [:],
445
+ Url :apps [0 ].Url .String ,
446
+ External :apps [0 ].External ,
447
+ Slug :apps [0 ].Slug ,
448
+ DisplayName :apps [0 ].DisplayName ,
449
+ Command :apps [0 ].Command .String ,
450
+ Icon :apps [0 ].Icon ,
451
+ Subdomain :apps [0 ].Subdomain ,
452
+ SubdomainName :"" ,// Empty because AppHostname is empty
453
+ SharingLevel :agentproto .WorkspaceApp_AUTHENTICATED ,
454
+ Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
455
+ Url :apps [0 ].HealthcheckUrl ,
456
+ Interval :durationpb .New (time .Duration (apps [0 ].HealthcheckInterval )* time .Second ),
457
+ Threshold :apps [0 ].HealthcheckThreshold ,
458
+ },
459
+ Health :agentproto .WorkspaceApp_HEALTHY ,
460
+ Hidden :false ,
461
+ },
462
+ {
463
+ Id :apps [1 ].ID [:],
464
+ Url :apps [1 ].Url .String ,
465
+ External :apps [1 ].External ,
466
+ Slug :apps [1 ].Slug ,
467
+ DisplayName :apps [1 ].DisplayName ,
468
+ Command :apps [1 ].Command .String ,
469
+ Icon :apps [1 ].Icon ,
470
+ Subdomain :false ,
471
+ SubdomainName :"" ,
472
+ SharingLevel :agentproto .WorkspaceApp_PUBLIC ,
473
+ Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
474
+ Url :"" ,
475
+ Interval :durationpb .New (0 ),
476
+ Threshold :0 ,
477
+ },
478
+ Health :agentproto .WorkspaceApp_DISABLED ,
479
+ Hidden :false ,
480
+ },
481
+ {
482
+ Id :apps [2 ].ID [:],
483
+ Url :apps [2 ].Url .String ,
484
+ External :apps [2 ].External ,
485
+ Slug :apps [2 ].Slug ,
486
+ DisplayName :apps [2 ].DisplayName ,
487
+ Command :apps [2 ].Command .String ,
488
+ Icon :apps [2 ].Icon ,
489
+ Subdomain :false ,
490
+ SubdomainName :"" ,
491
+ SharingLevel :agentproto .WorkspaceApp_OWNER ,
492
+ Healthcheck :& agentproto.WorkspaceApp_Healthcheck {
493
+ Url :apps [2 ].HealthcheckUrl ,
494
+ Interval :durationpb .New (time .Duration (apps [2 ].HealthcheckInterval )* time .Second ),
495
+ Threshold :apps [2 ].HealthcheckThreshold ,
496
+ },
497
+ Health :agentproto .WorkspaceApp_UNHEALTHY ,
498
+ Hidden :true ,
499
+ },
500
+ }
501
+
441
502
mDB := dbmock .NewMockStore (gomock .NewController (t ))
442
503
443
504
api := & agentapi.ManifestAPI {