@@ -229,31 +229,44 @@ class CoderRestClientTest {
229
229
// Nothing, so no resources.
230
230
emptyList(),
231
231
// One workspace with an agent, but no resources.
232
- listOf (TestWorkspace (DataGen .workspace(" ws1" , agents = mapOf (" agent1" to " 3f51da1d-306f-4a40-ac12-62bda5bc5f9a" )))),
232
+ listOf (
233
+ TestWorkspace (
234
+ DataGen .workspace(
235
+ " ws1" ,
236
+ agents = mapOf (" agent1" to " 3f51da1d-306f-4a40-ac12-62bda5bc5f9a" )
237
+ )
238
+ )
239
+ ),
233
240
// One workspace with an agent and resources that do not match the agent.
234
241
listOf (
235
242
TestWorkspace (
236
- workspace = DataGen .workspace(" ws1" , agents = mapOf (" agent1" to " 3f51da1d-306f-4a40-ac12-62bda5bc5f9a" )),
237
- resources =
238
- listOf (
239
- DataGen .resource(" agent2" , " 968eea5e-8787-439d-88cd-5bc440216a34" ),
240
- DataGen .resource(" agent3" , " 72fbc97b-952c-40c8-b1e5-7535f4407728" ),
243
+ workspace = DataGen .workspace(
244
+ " ws1" ,
245
+ agents = mapOf (" agent1" to " 3f51da1d-306f-4a40-ac12-62bda5bc5f9a" )
241
246
),
247
+ resources =
248
+ listOf (
249
+ DataGen .resource(" agent2" , " 968eea5e-8787-439d-88cd-5bc440216a34" ),
250
+ DataGen .resource(" agent3" , " 72fbc97b-952c-40c8-b1e5-7535f4407728" ),
251
+ ),
242
252
),
243
253
),
244
254
// Multiple workspaces but only one has resources.
245
255
listOf (
246
256
TestWorkspace (
247
- workspace = DataGen .workspace(" ws1" , agents = mapOf (" agent1" to " 3f51da1d-306f-4a40-ac12-62bda5bc5f9a" )),
257
+ workspace = DataGen .workspace(
258
+ " ws1" ,
259
+ agents = mapOf (" agent1" to " 3f51da1d-306f-4a40-ac12-62bda5bc5f9a" )
260
+ ),
248
261
resources = emptyList(),
249
262
),
250
263
TestWorkspace (
251
264
workspace = DataGen .workspace(" ws2" ),
252
265
resources =
253
- listOf (
254
- DataGen .resource(" agent2" , " 968eea5e-8787-439d-88cd-5bc440216a34" ),
255
- DataGen .resource(" agent3" , " 72fbc97b-952c-40c8-b1e5-7535f4407728" ),
256
- ),
266
+ listOf (
267
+ DataGen .resource(" agent2" , " 968eea5e-8787-439d-88cd-5bc440216a34" ),
268
+ DataGen .resource(" agent3" , " 72fbc97b-952c-40c8-b1e5-7535f4407728" ),
269
+ ),
257
270
),
258
271
TestWorkspace (
259
272
workspace = DataGen .workspace(" ws3" ),
@@ -272,7 +285,8 @@ class CoderRestClientTest {
272
285
val matches = resourceEndpoint.find(exchange.requestURI.path)
273
286
if (matches != null ) {
274
287
val templateVersionId = UUID .fromString(matches.destructured.toList()[0 ])
275
- val ws = workspaces.firstOrNull { it.workspace.latestBuild.templateVersionID == templateVersionId }
288
+ val ws =
289
+ workspaces.firstOrNull { it.workspace.latestBuild.templateVersionID == templateVersionId }
276
290
if (ws != null ) {
277
291
val body =
278
292
moshi.adapter<List <WorkspaceResource >>(
@@ -326,7 +340,8 @@ class CoderRestClientTest {
326
340
val buildMatch = buildEndpoint.find(exchange.requestURI.path)
327
341
if (buildMatch != null ) {
328
342
val workspaceId = UUID .fromString(buildMatch.destructured.toList()[0 ])
329
- val json = moshi.adapter(CreateWorkspaceBuildRequest ::class .java).fromJson(exchange.requestBody.source().buffer())
343
+ val json = moshi.adapter(CreateWorkspaceBuildRequest ::class .java)
344
+ .fromJson(exchange.requestBody.source().buffer())
330
345
if (json == null ) {
331
346
val response = Response (" No body" , " No body for create workspace build request" )
332
347
val body = moshi.adapter(Response ::class .java).toJson(response).toByteArray()
@@ -396,8 +411,8 @@ class CoderRestClientTest {
396
411
CoderSettings (
397
412
CoderSettingsState (
398
413
tlsCAPath = Path .of(" src/test/fixtures/tls" , " self-signed.crt" ).toString(),
399
- tlsAlternateHostname = " localhost" ,
400
- ),
414
+ tlsAlternateHostname = " localhost"
415
+ )
401
416
)
402
417
val user = DataGen .user()
403
418
val (srv, url) = mockTLSServer(" self-signed" )
@@ -422,8 +437,8 @@ class CoderRestClientTest {
422
437
CoderSettings (
423
438
CoderSettingsState (
424
439
tlsCAPath = Path .of(" src/test/fixtures/tls" , " self-signed.crt" ).toString(),
425
- tlsAlternateHostname = " fake.example.com" ,
426
- ),
440
+ tlsAlternateHostname = " fake.example.com"
441
+ )
427
442
)
428
443
val (srv, url) = mockTLSServer(" self-signed" )
429
444
val client = CoderRestClient (URL (url), " token" , settings)
@@ -441,8 +456,8 @@ class CoderRestClientTest {
441
456
val settings =
442
457
CoderSettings (
443
458
CoderSettingsState (
444
- tlsCAPath = Path .of(" src/test/fixtures/tls" , " self-signed.crt" ).toString(),
445
- ),
459
+ tlsCAPath = Path .of(" src/test/fixtures/tls" , " self-signed.crt" ).toString()
460
+ )
446
461
)
447
462
val (srv, url) = mockTLSServer(" no-signing" )
448
463
val client = CoderRestClient (URL (url), " token" , settings)
@@ -461,7 +476,7 @@ class CoderRestClientTest {
461
476
CoderSettings (
462
477
CoderSettingsState (
463
478
tlsCAPath = Path .of(" src/test/fixtures/tls" , " chain-root.crt" ).toString(),
464
- ),
479
+ )
465
480
)
466
481
val user = DataGen .user()
467
482
val (srv, url) = mockTLSServer(" chain" )
@@ -505,7 +520,8 @@ class CoderRestClientTest {
505
520
" bar" ,
506
521
true ,
507
522
object : ProxySelector () {
508
- override fun select (uri : URI ): List <Proxy > = listOf (Proxy (Proxy .Type .HTTP , InetSocketAddress (" localhost" , srv2.address.port)))
523
+ override fun select (uri : URI ): List <Proxy > =
524
+ listOf (Proxy (Proxy .Type .HTTP , InetSocketAddress (" localhost" , srv2.address.port)))
509
525
510
526
override fun connectFailed (
511
527
uri : URI ,
0 commit comments