abra/tests/integration/catalogue.bats

45 lines
989 B
Bash

#!/usr/bin/env bash
setup(){
load "$PWD/tests/integration/helpers/common"
_common_setup
}
# bats test_tags=slow
@test "generate entire catalogue" {
run $ABRA catalogue generate
assert_success
}
@test "error if unstaged changes" {
run bash -c "echo foo >> $ABRA_DIR/catalogue/foo"
assert_success
assert_exists "$ABRA_DIR/catalogue/foo"
run $ABRA catalogue generate
assert_failure
assert_output --partial 'locally unstaged changes'
run rm -rf "$ABRA_DIR/catalogue/foo"
assert_not_exists "$ABRA_DIR/catalogue/foo"
}
# bats test_tags=slow
@test "no error if unstaged and --chaos" {
run bash -c "echo foo >> $ABRA_DIR/catalogue/foo"
assert_success
assert_exists "$ABRA_DIR/catalogue/foo"
run $ABRA catalogue generate gitea --chaos
assert_success
run rm -rf "$ABRA_DIR/catalogue/foo"
assert_not_exists "$ABRA_DIR/catalogue/foo"
}
# bats test_tags=slow
@test "generate only specific recipe" {
run $ABRA catalogue generate gitea
assert_success
}