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