Add boundary connect alias bats tests (#4441)
* Add boundary connect alias bats tests Adding tests that validate the authorize-session requests when a host-id is provided when an alias is used, both configured and not configured with a host id already. Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>
This commit is contained in:
1 parent
e80e9a6da5
commit
c8ca773f9f
2 files changed
+61
-19
No files matched your search
@@ -11,4 +11,11 @@ function connect_alias() {
|
||||
local alias=$1
|
||||
# Note: When this command returns, the session immediately goes into a "canceling" state
|
||||
echo "foo" | boundary connect $alias -exec nc -- {{boundary.ip}} {{boundary.port}}
|
||||
}
|
||||
|
||||
function connect_alias_with_host_id() {
|
||||
local alias=$1
|
||||
local hostid=$2
|
||||
# Note: When this command returns, the session immediately goes into a "canceling" state
|
||||
echo "foo" | boundary connect $alias -host-id $hostid -exec nc -- {{boundary.ip}} {{boundary.port}}
|
||||
}
|
||||
@@ -4,10 +4,13 @@ load _auth
|
||||
load _connect
|
||||
load _aliases
|
||||
load _helpers
|
||||
load _hosts
|
||||
load _host_sets
|
||||
load _targets
|
||||
|
||||
export ALIAS_VALUE='test'
|
||||
export UPDATE_ALIAS_VALUE='test.change'
|
||||
export NEW_HOST="host_for_alias_test"
|
||||
|
||||
@test "boundary/login: can login as admin user" {
|
||||
run login $DEFAULT_LOGIN
|
||||
@@ -36,12 +39,60 @@ export UPDATE_ALIAS_VALUE='test.change'
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can update created alias " {
|
||||
@test "boundary/alias: admin user can read target using an alias" {
|
||||
run read_target $ALIAS_VALUE
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can connect to target using an alias" {
|
||||
run connect_alias $ALIAS_VALUE
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can connect passing in a host id" {
|
||||
run connect_alias_with_host_id $ALIAS_VALUE $DEFAULT_HOST
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can update alias host id" {
|
||||
local id=$(alias_id_from_target_alias $ALIAS_VALUE)
|
||||
run update_target_alias_host_id $id $DEFAULT_HOST
|
||||
[ "$status" -eq 0 ]
|
||||
local hostid=$(host_id_from_alias_id $id)
|
||||
[ "$hostid" == "$DEFAULT_HOST" ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can connect using an alias configured with host id" {
|
||||
run connect_alias $ALIAS_VALUE
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can connect using an alias configured with host id passing in same host id" {
|
||||
run connect_alias_with_host_id $ALIAS_VALUE $DEFAULT_HOST
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/host: admin can create new host" {
|
||||
run create_host $NEW_HOST $DEFAULT_HOST_CATALOG
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/host: admin can associate new host to host set" {
|
||||
local new_host_id=$(host_id $NEW_HOST $DEFAULT_HOST_CATALOG)
|
||||
run assoc_host_set_host $new_host_id $DEFAULT_HOST_SET
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user cannot connect using an alias configured with host id passing in different host id" {
|
||||
local new_host_id=$(host_id NEW_HOST $DEFAULT_HOST_CATALOG)
|
||||
run connect_alias_with_host_id $ALIAS_VALUE $new_host_id
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "boundary/host: admin can delete new host" {
|
||||
local new_host_id=$(host_id $NEW_HOST $DEFAULT_HOST_CATALOG)
|
||||
run delete_host $new_host_id
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can remove destination id and host id will also be cleared out" {
|
||||
@@ -63,22 +114,6 @@ export UPDATE_ALIAS_VALUE='test.change'
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can re-create alias" {
|
||||
run create_target_alias $ALIAS_VALUE $DEFAULT_TARGET
|
||||
echo $output
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can connect to target using an alias" {
|
||||
run connect_alias $ALIAS_VALUE
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: admin user can read target using an alias" {
|
||||
run read_target $ALIAS_VALUE
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/alias: can login as unpriv user" {
|
||||
run login $DEFAULT_UNPRIVILEGED_LOGIN
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
Reference in new issue
Block a user