2023-09-05 09:12:21 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-09-07 16:50:25 +00:00
|
|
|
setup(){
|
|
|
|
load "$PWD/tests/integration/helpers/common"
|
|
|
|
_common_setup
|
|
|
|
|
|
|
|
if [[ -d "$ABRA_DIR" ]]; then
|
|
|
|
rm -rf "$ABRA_DIR"
|
|
|
|
fi
|
2023-09-05 09:12:21 +00:00
|
|
|
}
|
|
|
|
|
2023-09-07 16:50:25 +00:00
|
|
|
@test "ABRA_DIR is overriden" {
|
2023-09-05 09:57:02 +00:00
|
|
|
ABRA_DIR="$HOME/.abra_foo"
|
|
|
|
|
|
|
|
run $ABRA app ls
|
|
|
|
|
|
|
|
# no servers yet, so will fail. however, it will run the required code which
|
|
|
|
# checks if it should create these base directories and that is what we want
|
|
|
|
assert_failure
|
|
|
|
|
2023-09-07 16:50:25 +00:00
|
|
|
assert_exists "$HOME/.abra_foo"
|
|
|
|
|
|
|
|
run rm -rf "$ABRA_DIR"
|
|
|
|
assert_success
|
2023-09-05 09:57:02 +00:00
|
|
|
}
|
|
|
|
|
2023-09-07 16:50:25 +00:00
|
|
|
@test "abra directory is created" {
|
2023-09-05 09:12:21 +00:00
|
|
|
run $ABRA app ls
|
|
|
|
|
|
|
|
# no servers yet, so will fail. however, it will run the required code which
|
|
|
|
# checks if it should create these base directories and that is what we want
|
|
|
|
assert_failure
|
|
|
|
|
2023-09-07 16:50:25 +00:00
|
|
|
assert_exists "$ABRA_DIR"
|
|
|
|
assert_exists "$ABRA_DIR/servers"
|
|
|
|
assert_exists "$ABRA_DIR/recipes"
|
|
|
|
assert_exists "$ABRA_DIR/backups"
|
|
|
|
assert_exists "$ABRA_DIR/vendor"
|
|
|
|
assert_exists "$ABRA_DIR/catalogue"
|
2023-09-05 09:12:21 +00:00
|
|
|
}
|
|
|
|
|
2023-09-05 09:57:02 +00:00
|
|
|
@test "catalogue recipe is a git repository" {
|
2023-09-05 09:12:21 +00:00
|
|
|
run $ABRA app ls
|
|
|
|
|
|
|
|
# no servers yet, so will fail. however, it will run the required code which
|
|
|
|
# checks if it should create these base directories and that is what we want
|
|
|
|
assert_failure
|
|
|
|
|
|
|
|
assert_output --partial 'local recipe catalogue is missing'
|
|
|
|
|
2023-09-07 16:50:25 +00:00
|
|
|
assert_exists "$ABRA_DIR/catalogue"
|
|
|
|
assert_exists "$ABRA_DIR/catalogue/.git"
|
2023-09-05 09:12:21 +00:00
|
|
|
}
|