tests: ensure default user can connect to default target and ensure created target has intended host sets (#646)

pull/653/head
Jeff Malnick 6 years ago committed by GitHub
parent 20822e28f8
commit 7f48e2edc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -34,3 +34,21 @@ function target_id() {
local name=$2
strip $(list_targets $sid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
}
function target_host_set_ids() {
local tid=$1
boundary targets read -id $tid -format json | jq '.host_sets[].id'
}
function target_has_host_set_id() {
local tid=$1
local hsid=$2
ids=$(target_host_set_ids $tid)
for id in $ids; do
if [ $(strip "$id") == "$hsid" ]; then
return 0
fi
done
return 1
}

@ -11,6 +11,12 @@ load _helpers
[ "$status" -eq 0 ]
}
@test "boundary/target/connect: default user can connect to default target" {
run connect_nc $DEFAULT_TARGET
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/target: default user can create target" {
run create_tcp_target $DEFAULT_P_ID 22 $TGT_NAME
[ "$status" -eq 0 ]
@ -34,6 +40,13 @@ load _helpers
[ "$status" -eq 0 ]
}
@test "boundary/target: created target has default host set" {
local id=$(target_id $DEFAULT_P_ID $TGT_NAME)
run target_has_host_set_id $id $DEFAULT_HOST_SET
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/target/connect: default user can connect to created target" {
local id=$(target_id $DEFAULT_P_ID $TGT_NAME)
run connect_nc $id

Loading…
Cancel
Save