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

This commit is contained in:
Jeff Malnick authored and GitHub committed 2020-10-13 07:41:14 -07:00
1 parent 20822e28f8
commit 7f48e2edc6
2 files changed
+31

No files matched your search

+18
View File
@@ -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
}
+13
View File
@@ -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