fix: overridable ABRA_DIR
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
25258d3d64
commit
58e78e4d7c
|
@ -17,9 +17,8 @@ import (
|
|||
// getBaseDir retrieves the Abra base directory.
|
||||
func getBaseDir() string {
|
||||
home := os.ExpandEnv("$HOME/.abra")
|
||||
if _, exists := os.LookupEnv("ABRA_TEST"); exists {
|
||||
home = os.ExpandEnv("$HOME/.abra_test")
|
||||
logrus.Debugf("running under test mode as requested (ABRA_TEST)")
|
||||
if customAbraDir, exists := os.LookupEnv("ABRA_DIR"); exists && customAbraDir != "" {
|
||||
home = customAbraDir
|
||||
}
|
||||
return home
|
||||
}
|
||||
|
|
|
@ -6,22 +6,34 @@ setup() {
|
|||
_setup_env
|
||||
}
|
||||
|
||||
@test "ensure abra directories created" {
|
||||
@test "ABRA_DIR can be overriden" {
|
||||
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
|
||||
|
||||
assert [ -d "$ABRA_TEST_DIR" ]
|
||||
assert [ -d "$ABRA_TEST_DIR/servers" ]
|
||||
assert [ -d "$ABRA_TEST_DIR/recipes" ]
|
||||
assert [ -d "$ABRA_TEST_DIR/backups" ]
|
||||
assert [ -d "$ABRA_TEST_DIR/vendor" ]
|
||||
assert [ -d "$ABRA_TEST_DIR/catalogue" ]
|
||||
assert [ -d "$HOME/.abra_foo" ]
|
||||
}
|
||||
|
||||
@test "ensure catalogue recipe is a git repository" {
|
||||
@test "abra directories created" {
|
||||
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 [ -d "$ABRA_DIR" ]
|
||||
assert [ -d "$ABRA_DIR/servers" ]
|
||||
assert [ -d "$ABRA_DIR/recipes" ]
|
||||
assert [ -d "$ABRA_DIR/backups" ]
|
||||
assert [ -d "$ABRA_DIR/vendor" ]
|
||||
assert [ -d "$ABRA_DIR/catalogue" ]
|
||||
}
|
||||
|
||||
@test "catalogue recipe is a git repository" {
|
||||
run $ABRA app ls
|
||||
|
||||
# no servers yet, so will fail. however, it will run the required code which
|
||||
|
@ -30,8 +42,8 @@ setup() {
|
|||
|
||||
assert_output --partial 'local recipe catalogue is missing'
|
||||
|
||||
assert [ -d "$ABRA_TEST_DIR/catalogue" ]
|
||||
assert [ -d "$ABRA_TEST_DIR/catalogue/.git" ]
|
||||
assert [ -d "$ABRA_DIR/catalogue" ]
|
||||
assert [ -d "$ABRA_DIR/catalogue/.git" ]
|
||||
}
|
||||
|
||||
teardown(){
|
||||
|
|
|
@ -24,13 +24,12 @@ _setup_env(){
|
|||
ABRA="$ROOT/abra"
|
||||
KADABRA="$ROOT/kadabra"
|
||||
|
||||
ABRA_TEST=true
|
||||
ABRA_TEST_DIR="$HOME/.abra_test"
|
||||
ABRA_DIR="$HOME/.abra_test"
|
||||
|
||||
_build_abra
|
||||
_build_kadabra
|
||||
}
|
||||
|
||||
_default_teardown(){
|
||||
rm -rf "$ABRA_TEST_DIR"
|
||||
rm -rf "$ABRA_DIR"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue