test: return/echo from git helper functions #416
@ -50,9 +50,7 @@ teardown(){
|
|||||||
assert_success
|
assert_success
|
||||||
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||||
|
|
||||||
_get_tag_hash 0.1.1+1.20.2
|
assert_equal $(_get_tag_hash 0.1.1+1.20.2) $(_get_current_hash)
|
||||||
_get_current_hash
|
|
||||||
assert_equal "$tagHash" "$currentHash"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "does not overwrite existing env files" {
|
@test "does not overwrite existing env files" {
|
||||||
@ -113,13 +111,12 @@ teardown(){
|
|||||||
|
|
||||||
@test "ensure recipe up to date if no --offline" {
|
@test "ensure recipe up to date if no --offline" {
|
||||||
_reset_recipe
|
_reset_recipe
|
||||||
_get_n_hash 3
|
wantHash=$(_get_n_hash 3)
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
_get_current_hash
|
assert_equal $(_get_current_hash) "$wantHash"
|
||||||
assert_equal "$currentHash" "$nHash"
|
|
||||||
|
|
||||||
run $ABRA app new "$TEST_RECIPE" \
|
run $ABRA app new "$TEST_RECIPE" \
|
||||||
--no-input \
|
--no-input \
|
||||||
@ -128,22 +125,19 @@ teardown(){
|
|||||||
assert_success
|
assert_success
|
||||||
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||||
|
|
||||||
_get_head_hash
|
assert_equal $(_get_head_hash) $(_get_current_hash)
|
||||||
_get_current_hash
|
|
||||||
assert_equal "$HEAD_HASH" "$CURRENT_HASH"
|
|
||||||
|
|
||||||
_reset_recipe
|
_reset_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ensure recipe not up to date if --offline" {
|
@test "ensure recipe not up to date if --offline" {
|
||||||
_reset_recipe
|
_reset_recipe
|
||||||
_get_n_hash 3
|
wantHash=$(_get_n_hash 3)
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
_get_current_hash
|
assert_equal $(_get_current_hash) "$wantHash"
|
||||||
assert_equal "$currentHash" "$nHash"
|
|
||||||
|
|
||||||
# NOTE(d1): need to use --chaos to force same commit
|
# NOTE(d1): need to use --chaos to force same commit
|
||||||
run $ABRA app new "$TEST_RECIPE" \
|
run $ABRA app new "$TEST_RECIPE" \
|
||||||
@ -155,8 +149,7 @@ teardown(){
|
|||||||
assert_success
|
assert_success
|
||||||
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||||
|
|
||||||
_get_current_hash
|
assert_equal $(_get_current_hash) "$wantHash"
|
||||||
assert_equal "$currentHash" "$nHash"
|
|
||||||
|
|
||||||
_reset_recipe
|
_reset_recipe
|
||||||
}
|
}
|
||||||
|
@ -48,19 +48,23 @@ _git_commit() {
|
|||||||
_get_tag_hash() {
|
_get_tag_hash() {
|
||||||
tagHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-list -n 1 "$1")
|
tagHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-list -n 1 "$1")
|
||||||
assert_success
|
assert_success
|
||||||
|
echo "$tagHash"
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_head_hash() {
|
_get_head_hash() {
|
||||||
headHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" HEAD)
|
headHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" HEAD)
|
||||||
assert_success
|
assert_success
|
||||||
|
echo "$headHash"
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_current_hash() {
|
_get_current_hash() {
|
||||||
currentHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H")
|
currentHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H")
|
||||||
assert_success
|
assert_success
|
||||||
|
echo "$currentHash"
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_n_hash() {
|
_get_n_hash() {
|
||||||
nHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1")
|
nHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1")
|
||||||
assert_success
|
assert_success
|
||||||
|
echo "$nHash"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user