test: tag/git helpers & refactor [ci skip]
This commit is contained in:
@ -1,11 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_checkout_recipe() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo 'forgot to pass argument to function?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$1" checkout .
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout .
|
||||
assert_success
|
||||
}
|
||||
|
||||
_remove_tags(){
|
||||
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
|
||||
assert_success
|
||||
refute_output '0'
|
||||
|
||||
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | \
|
||||
xargs -I{} git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -d {}'
|
||||
assert_success
|
||||
assert_output --partial 'Deleted tag'
|
||||
|
||||
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
|
||||
assert_success
|
||||
assert_output '0'
|
||||
}
|
||||
|
||||
_reset_tags() {
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" fetch --all
|
||||
assert_success
|
||||
|
||||
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
|
||||
assert_success
|
||||
refute_output '0'
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_fetch_recipe() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo 'forgot to pass argument to function?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$ABRA_DIR/recipes/$1" ]]; then
|
||||
if [[ ! -d "$ABRA_DIR/recipes/$TEST_RECIPE" ]]; then
|
||||
run mkdir -p "$ABRA_DIR/recipes"
|
||||
assert_success
|
||||
|
||||
run git clone "https://git.coopcloud.tech/coop-cloud/$1" "$ABRA_DIR/recipes/$1"
|
||||
run git clone "https://git.coopcloud.tech/coop-cloud/$TEST_RECIPE" "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
assert_success
|
||||
fi
|
||||
}
|
||||
|
||||
_reset_recipe(){
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
assert_success
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
|
||||
_fetch_recipe
|
||||
}
|
||||
|
Reference in New Issue
Block a user