Files
.gitea
cli
cmd
pkg
scripts
tests
integration
helpers
app.bash
common.bash
docker.bash
file.bash
git.bash
recipe.bash
server.bash
app_backup.bats
app_check.bats
app_cmd.bats
app_config.bats
app_cp.bats
app_deploy.bats
app_list.bats
app_logs.bats
app_new.bats
app_ps.bats
app_remove.bats
app_restart.bats
app_restore.bats
app_rollback.bats
app_run.bats
app_secret.bats
app_services.bats
app_undeploy.bats
app_upgrade.bats
app_version.bats
app_volume.bats
autocomplete.bats
catalogue.bats
dirs.bats
install.bats
recipe_diff.bats
recipe_fetch.bats
recipe_lint.bats
recipe_list.bats
recipe_new.bats
recipe_release.bats
recipe_reset.bats
recipe_sync.bats
recipe_upgrade.bats
recipe_version.bats
server_add.bats
server_list.bats
server_prune.bats
server_remove.bats
setup_suite.bash
upgrade.bats
version.bats
resources
README.md
.dockerignore
.drone.yml
.envrc.sample
.gitignore
.goreleaser.yml
AUTHORS.md
Dockerfile
LICENSE
Makefile
README.md
go.mod
go.sum
renovate.json
abra/tests/integration/helpers/git.bash

63 lines
1.5 KiB
Bash

#!/usr/bin/env bash
_checkout_recipe() {
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'
}
_set_git_author() {
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" config --local user.email test@example.com
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" config --local user.name test
assert_success
}
_git_commit() {
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" add .
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" commit -m "test: helpers/git.bash: _git_commit"
assert_success
}
_get_tag_hash() {
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-list -n 1 "$1")
}
_get_head_hash() {
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" HEAD)
}
_get_current_hash() {
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H")
}
_get_n_hash() {
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1")
}