@@ -156,6 +156,19 @@ func TestGetManifest(t *testing.T) {
156
156
CollectedAt : someTime .Add (time .Hour ),
157
157
},
158
158
}
159
+ devcontainers = []database.WorkspaceAgentDevcontainer {
160
+ {
161
+ ID : uuid .New (),
162
+ WorkspaceAgentID : agent .ID ,
163
+ WorkspaceFolder : "/cool/folder" ,
164
+ },
165
+ {
166
+ ID : uuid .New (),
167
+ WorkspaceAgentID : agent .ID ,
168
+ WorkspaceFolder : "/another/cool/folder" ,
169
+ ConfigPath : "/another/cool/folder/.devcontainer/devcontainer.json" ,
170
+ },
171
+ }
159
172
derpMapFn = func () * tailcfg.DERPMap {
160
173
return & tailcfg.DERPMap {
161
174
Regions : map [int ]* tailcfg.DERPRegion {
@@ -267,6 +280,17 @@ func TestGetManifest(t *testing.T) {
267
280
Timeout : durationpb .New (time .Duration (metadata [1 ].Timeout )),
268
281
},
269
282
}
283
+ protoDevcontainers = []* agentproto.WorkspaceAgentDevcontainer {
284
+ {
285
+ Id : devcontainers [0 ].ID [:],
286
+ WorkspaceFolder : devcontainers [0 ].WorkspaceFolder ,
287
+ },
288
+ {
289
+ Id : devcontainers [1 ].ID [:],
290
+ WorkspaceFolder : devcontainers [1 ].WorkspaceFolder ,
291
+ ConfigPath : devcontainers [1 ].ConfigPath ,
292
+ },
293
+ }
270
294
)
271
295
272
296
t .Run ("OK" , func (t * testing.T ) {
@@ -299,6 +323,7 @@ func TestGetManifest(t *testing.T) {
299
323
WorkspaceAgentID : agent .ID ,
300
324
Keys : nil , // all
301
325
}).Return (metadata , nil )
326
+ mDB .EXPECT ().GetWorkspaceAgentDevcontainersByWorkspaceAgentID (gomock .Any (), agent .ID ).Return (devcontainers , nil )
302
327
mDB .EXPECT ().GetWorkspaceByID (gomock .Any (), workspace .ID ).Return (workspace , nil )
303
328
mDB .EXPECT ().GetUserByID (gomock .Any (), workspace .OwnerID ).Return (owner , nil )
304
329
@@ -321,10 +346,11 @@ func TestGetManifest(t *testing.T) {
321
346
// tailnet.DERPMapToProto() is extensively tested elsewhere, so it's
322
347
// not necessary to manually recreate a big DERP map here like we
323
348
// did for apps and metadata.
324
- DerpMap : tailnet .DERPMapToProto (derpMapFn ()),
325
- Scripts : protoScripts ,
326
- Apps : protoApps ,
327
- Metadata : protoMetadata ,
349
+ DerpMap : tailnet .DERPMapToProto (derpMapFn ()),
350
+ Scripts : protoScripts ,
351
+ Apps : protoApps ,
352
+ Metadata : protoMetadata ,
353
+ Devcontainers : protoDevcontainers ,
328
354
}
329
355
330
356
// Log got and expected with spew.
@@ -364,6 +390,7 @@ func TestGetManifest(t *testing.T) {
364
390
WorkspaceAgentID : agent .ID ,
365
391
Keys : nil , // all
366
392
}).Return (metadata , nil )
393
+ mDB .EXPECT ().GetWorkspaceAgentDevcontainersByWorkspaceAgentID (gomock .Any (), agent .ID ).Return (devcontainers , nil )
367
394
mDB .EXPECT ().GetWorkspaceByID (gomock .Any (), workspace .ID ).Return (workspace , nil )
368
395
mDB .EXPECT ().GetUserByID (gomock .Any (), workspace .OwnerID ).Return (owner , nil )
369
396
@@ -386,10 +413,11 @@ func TestGetManifest(t *testing.T) {
386
413
// tailnet.DERPMapToProto() is extensively tested elsewhere, so it's
387
414
// not necessary to manually recreate a big DERP map here like we
388
415
// did for apps and metadata.
389
- DerpMap : tailnet .DERPMapToProto (derpMapFn ()),
390
- Scripts : protoScripts ,
391
- Apps : protoApps ,
392
- Metadata : protoMetadata ,
416
+ DerpMap : tailnet .DERPMapToProto (derpMapFn ()),
417
+ Scripts : protoScripts ,
418
+ Apps : protoApps ,
419
+ Metadata : protoMetadata ,
420
+ Devcontainers : protoDevcontainers ,
393
421
}
394
422
395
423
// Log got and expected with spew.
0 commit comments