From cdf18b6369cdb57d5e354c0d86d0f9fee50b9287 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Tue, 30 May 2023 18:11:19 +0000 Subject: [PATCH] test(cli/targets): Add test case for default client port --- internal/tests/cli/boundary/_targets.bash | 5 +++++ internal/tests/cli/boundary/target.bats | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/internal/tests/cli/boundary/_targets.bash b/internal/tests/cli/boundary/_targets.bash index cd68a1e48..048039f20 100644 --- a/internal/tests/cli/boundary/_targets.bash +++ b/internal/tests/cli/boundary/_targets.bash @@ -30,6 +30,11 @@ function create_tcp_target_with_addr() { -format json } +function update_tcp_target() { + boundary targets \ + update tcp $@ +} + function read_target() { boundary targets read -id $1 -format json } diff --git a/internal/tests/cli/boundary/target.bats b/internal/tests/cli/boundary/target.bats index f609a2ad6..8fc83606f 100644 --- a/internal/tests/cli/boundary/target.bats +++ b/internal/tests/cli/boundary/target.bats @@ -90,6 +90,21 @@ load _target_host_sources [ "$status" -eq 0 ] } +@test "boundary/target/client_port: admin user set can set a client port" { + local id=$(target_id_from_name $DEFAULT_P_ID $TGT_NAME) + run update_tcp_target -id $id -default-client-port 1234 + echo "$output" + [ "$status" -eq 0 ] + + run read_target $id + [ "$status" -eq 0 ] + got=$(echo "$output") + + echo "$got" + run field_eq "$got" ".item.attributes.default_client_port" "1234" + [ "$status" -eq 0 ] +} + @test "boundary/target: default user can delete target" { local id=$(target_id_from_name $DEFAULT_P_ID $TGT_NAME) run delete_target $id @@ -134,4 +149,4 @@ load _target_host_sources [ "$status" -eq 0 ] run update_address $id "localhost" [ "$status" -eq 0 ] -} \ No newline at end of file +}