forked from toolshed/abra
fix: recipe workflow with integration tests
This commit is contained in:
@ -1,25 +1,107 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
setup() {
|
||||
setup_file(){
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
_add_server
|
||||
_new_app
|
||||
}
|
||||
|
||||
teardown_file(){
|
||||
_rm_server
|
||||
}
|
||||
|
||||
setup(){
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "pull in latest changes" {
|
||||
run $ABRA recipe fetch matrix-synapse
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/matrix-synapse" reset --hard HEAD~3
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/matrix-synapse" status
|
||||
assert_success
|
||||
assert_output --partial 'behind 3'
|
||||
|
||||
run $ABRA recipe release matrix-synapse --no-input
|
||||
@test "validate recipe argument" {
|
||||
run $ABRA recipe release --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'no recipe name provided'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/matrix-synapse" status
|
||||
refute_output --partial 'behind 3'
|
||||
run $ABRA recipe release DOESNTEXIST --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'unable to validate recipe'
|
||||
}
|
||||
|
||||
@test "release patch bump" {
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
||||
assert_success
|
||||
assert_output '0.1.0+1.20.0'
|
||||
|
||||
run bash -c 'cat "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml" | grep -q "0.1.0+1.20.0"'
|
||||
assert_success
|
||||
|
||||
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||
assert_success
|
||||
assert_output --partial 'image: nginx:1.20.2'
|
||||
|
||||
run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
|
||||
assert_success
|
||||
assert_output --partial 'synced label'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||
assert_success
|
||||
assert_output --partial 'coop-cloud.${STACK_NAME}.version=0.1.1+1.20.2'
|
||||
|
||||
run $ABRA recipe release "$TEST_RECIPE" --no-input --patch
|
||||
assert_success
|
||||
assert_output --partial 'no -p/--publish passed, not publishing'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
||||
assert_success
|
||||
assert_output --partial '0.1.0+1.20.0'
|
||||
assert_output --partial '0.1.1+1.20.2'
|
||||
|
||||
_checkout_recipe "$TEST_RECIPE"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~1
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -d '0.1.1+1.20.2'
|
||||
assert_success
|
||||
assert_output --partial "Deleted tag '0.1.1+1.20.2'"
|
||||
}
|
||||
|
||||
@test "release minor bump" {
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
||||
assert_success
|
||||
assert_output '0.1.0+1.20.0'
|
||||
|
||||
run bash -c 'grep -q "0.1.0+1.20.0" "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"'
|
||||
assert_success
|
||||
|
||||
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --minor
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||
assert_success
|
||||
assert_output --regexp 'image: nginx:1.2.*'
|
||||
|
||||
run $ABRA recipe sync "$TEST_RECIPE" --no-input --minor
|
||||
assert_success
|
||||
assert_output --partial 'synced label'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||
assert_success
|
||||
assert_output --regexp 'coop-cloud\.\$\{STACK_NAME\}\.version=0\.2\.0\+1\.2.*'
|
||||
|
||||
run $ABRA recipe release "$TEST_RECIPE" --no-input --minor
|
||||
assert_success
|
||||
assert_output --partial 'no -p/--publish passed, not publishing'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
||||
assert_success
|
||||
assert_output --partial '0.1.0+1.20.0'
|
||||
assert_output --regexp '0\.2\.0\+1\.2.*'
|
||||
|
||||
# NOTE(d1): nuke it since we can't clean up the tag
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
assert_success
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
}
|
||||
|
Reference in New Issue
Block a user