Files
threshold/internal/tests/cli/boundary/target.bats
T
9169c6bacb [QTI-220] Add infrastructure integration testing (#2282)
* [QTI-275] Add infrastructure integration testing

On pull requests that originate from branches of the `hashicorp/boundary`
repo, we now conditionally dispatch infrastructure integration tests using
the Enos framework. The `integration` Enos scenario includes two `builder`
variants which allow developers or CI to deploy a Boundary cluster in AWS
using either a local `boundary` install bundle or that which is produced
in the `build` workflow for CRT. The `test` variants determine which type
of infrastructure integration test to run. At present those options are
`cli_ui` (Bats CLI tests) or `smoke` (creates target instances and a
target host catalog and verifies that `boundary` works).

In addition to the new workflow and quality scenarios, we simplified the
some `build` workflow steps and added Go module caching to speed up the
build pipeline.

See the [enos/README.md](https://github.com/hashicorp/boundary/blob/main/enos/README.md)
for a detailed explanation on how to configure and execute Enos scenarios
from your machine.

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Rebecca Willett <rwillett@hashicorp.com>
Co-authored-by: Josh Branch <jbrand@hashicorp.com>
2022-07-28 14:48:51 -06:00

108 lines
2.7 KiB
Bash

#!/usr/bin/env bats
load _auth
load _connect
load _targets
load _helpers
@test "boundary/login: can login as admin user" {
run login $DEFAULT_LOGIN
[ "$status" -eq 0 ]
}
@test "boundary/target/connect: admin user can connect to default target" {
run connect_nc $DEFAULT_TARGET
[ "$status" -eq 0 ]
}
@test "boundary/target: admin user can read default target" {
run read_target $DEFAULT_TARGET
[ "$status" -eq 0 ]
}
@test "boundary/login: can login as unpriv user" {
run login $DEFAULT_UNPRIVILEGED_LOGIN
[ "$status" -eq 0 ]
}
@test "boundary/target/connect: unpriv user can connect to default target" {
if [ "$SKIP_FAILING_TESTS_IN_CI" == "true" ]; then
skip
fi
run connect_nc $DEFAULT_TARGET
[ "$status" -eq 0 ]
diag "$output"
}
@test "boundary/target: unpriv user can not read default target" {
run read_target $DEFAULT_TARGET
[ "$status" -eq 1 ]
}
@test "boundary/login: login back in as admin user" {
run login $DEFAULT_LOGIN
[ "$status" -eq 0 ]
}
@test "boundary/target: admin user can create target" {
run create_tcp_target $DEFAULT_P_ID 22 $TGT_NAME
echo $output
[ "$status" -eq 0 ]
}
@test "boundary/target: admin user can not create already created target" {
run create_tcp_target $DEFAULT_P_ID 22 $TGT_NAME
[ "$status" -eq 1 ]
}
@test "boundary/target: admin user can read created target" {
local id=$(target_id_from_name $DEFAULT_P_ID $TGT_NAME)
run read_target $id
[ "$status" -eq 0 ]
}
@test "boundary/target: the $TGT_NAME target contains default authorized-actions" {
local id=$(target_id_from_name $DEFAULT_P_ID $TGT_NAME)
local out=$(read_target $id)
run has_default_target_actions "$out"
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/target: admin user can add default host set to created target" {
local id=$(target_id_from_name $DEFAULT_P_ID $TGT_NAME)
run assoc_host_sets $id $DEFAULT_HOST_SET
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/target: created target has default host set" {
local id=$(target_id_from_name $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_from_name $DEFAULT_P_ID $TGT_NAME)
run connect_nc $id
echo "connecting to $id: $output"
[ "$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
run has_status_code "$output" "204"
[ "$status" -eq 0 ]
}
@test "boundary/target: default user can not read deleted target" {
local id=$(target_id_from_name $DEFAULT_P_ID $TGT_NAME)
run read_target $id
[ "$status" -eq 1 ]
}