@@ -308,7 +308,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
308
308
require .Equal (t , c .TargetAddress , strings .TrimSpace (string (output .Stdout )))
309
309
t .Log ("Successfully connected to target with new filter" )
310
310
311
- // Remove tags
311
+ // Remove API tags
312
312
output = e2e .RunCommand (ctx , "boundary" ,
313
313
e2e .WithArgs (
314
314
"workers" , "remove-worker-tags" ,
@@ -330,4 +330,71 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
330
330
require .NoError (t , err )
331
331
require .NotContains (t , workerReadResult .Item .CanonicalTags ["k" ], "v" )
332
332
require .NotContains (t , workerReadResult .Item .CanonicalTags ["a" ], "v" )
333
+
334
+ // Add an API tag that's the same as a config tag
335
+ t .Log ("Adding API tag that's the same as a config tag..." )
336
+ require .NoError (t , err )
337
+ output = e2e .RunCommand (ctx , "boundary" ,
338
+ e2e .WithArgs (
339
+ "workers" , "add-worker-tags" ,
340
+ "-id" , workerList [0 ].Id ,
341
+ "-tag" , fmt .Sprintf ("%s=%s" , "type" , c .WorkerTagEgress ),
342
+ ),
343
+ )
344
+ require .NoError (t , output .Err , string (output .Stderr ))
345
+ t .Cleanup (func () {
346
+ _ = e2e .RunCommand (ctx , "boundary" ,
347
+ e2e .WithArgs (
348
+ "workers" , "remove-worker-tags" ,
349
+ "-id" , workerList [0 ].Id ,
350
+ "-tag" , fmt .Sprintf ("%s=%s" , "type" , c .WorkerTagEgress ),
351
+ ),
352
+ )
353
+ })
354
+ output = e2e .RunCommand (ctx , "boundary" ,
355
+ e2e .WithArgs (
356
+ "targets" , "update" , "tcp" ,
357
+ "-id" , targetId ,
358
+ "-egress-worker-filter" , fmt .Sprintf (`"%s" in "/tags/type"` , c .WorkerTagEgress ),
359
+ ),
360
+ )
361
+ require .NoError (t , output .Err , string (output .Stderr ))
362
+ output = e2e .RunCommand (ctx , "boundary" ,
363
+ e2e .WithArgs (
364
+ "connect" , "ssh" ,
365
+ "-target-id" , targetId ,
366
+ "-remote-command" , "hostname -i" ,
367
+ "--" ,
368
+ "-o" , "UserKnownHostsFile=/dev/null" ,
369
+ "-o" , "StrictHostKeyChecking=no" ,
370
+ "-o" , "IdentitiesOnly=yes" , // forces the use of the provided key
371
+ ),
372
+ )
373
+ require .NoError (t , output .Err , string (output .Stderr ))
374
+ require .Equal (t , c .TargetAddress , strings .TrimSpace (string (output .Stdout )))
375
+ t .Log ("Successfully connected to target" )
376
+
377
+ // Remove API tag
378
+ output = e2e .RunCommand (ctx , "boundary" ,
379
+ e2e .WithArgs (
380
+ "workers" , "remove-worker-tags" ,
381
+ "-id" , workerList [0 ].Id ,
382
+ "-tag" , fmt .Sprintf ("%s=%s" , "type" , c .WorkerTagEgress ),
383
+ ),
384
+ )
385
+ require .NoError (t , output .Err , string (output .Stderr ))
386
+ output = e2e .RunCommand (ctx , "boundary" ,
387
+ e2e .WithArgs (
388
+ "connect" , "ssh" ,
389
+ "-target-id" , targetId ,
390
+ "-remote-command" , "hostname -i" ,
391
+ "--" ,
392
+ "-o" , "UserKnownHostsFile=/dev/null" ,
393
+ "-o" , "StrictHostKeyChecking=no" ,
394
+ "-o" , "IdentitiesOnly=yes" , // forces the use of the provided key
395
+ ),
396
+ )
397
+ require .NoError (t , output .Err , string (output .Stderr ))
398
+ require .Equal (t , c .TargetAddress , strings .TrimSpace (string (output .Stdout )))
399
+ t .Log ("Successfully connected to target" )
333
400
}
0 commit comments