test: fixes for test suite post-cobra migrate
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
See toolshed/organising#650
This commit is contained in:
parent
8fa20e2c7f
commit
008582c3d9
@ -59,6 +59,7 @@ does not).`,
|
||||
// "app" should not be there, but there is no reliable way to detect arg
|
||||
// count when the user can pass an arbitrary amount of recipe command
|
||||
// arguments
|
||||
return nil
|
||||
}
|
||||
|
||||
if !(len(args) >= 3) {
|
||||
|
@ -1,188 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
setup_file() {
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
_add_server
|
||||
_new_app
|
||||
}
|
||||
|
||||
teardown_file() {
|
||||
_rm_app
|
||||
_rm_server
|
||||
_reset_recipe
|
||||
}
|
||||
|
||||
setup() {
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
}
|
||||
|
||||
teardown(){
|
||||
_undeploy_app
|
||||
}
|
||||
|
||||
@test "retrieve recipe if missing" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
assert_success
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'no containers matching'
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
}
|
||||
|
||||
@test "bail if unstaged changes and no --chaos" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_success
|
||||
assert_output --partial 'foo'
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" app
|
||||
assert_failure
|
||||
assert_output --partial 'locally unstaged changes'
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
_checkout_recipe
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "do not bail if unstaged changes and --chaos" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run bash -c 'echo "unstaged changes" >> "$ABRA_DIR/recipes/$TEST_RECIPE/foo"'
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_success
|
||||
assert_output --partial 'foo'
|
||||
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" --chaos --no-input
|
||||
assert_success
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" app --chaos
|
||||
assert_success
|
||||
assert_output --partial 'running backup for the app service'
|
||||
|
||||
_undeploy_app
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
}
|
||||
|
||||
@test "ensure recipe up to date if no --offline" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --partial 'behind 3'
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" --debug
|
||||
assert_failure
|
||||
assert_output --partial 'no containers matching'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
refute_output --partial 'behind 3'
|
||||
|
||||
_reset_recipe
|
||||
}
|
||||
|
||||
@test "ensure recipe not up to date if --offline" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)"
|
||||
refute [ -z "$latestCommit" ];
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --partial 'behind 3'
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" --debug --offline
|
||||
assert_failure
|
||||
assert_output --partial 'no containers matching'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --partial 'behind 3'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$latestCommit"
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
refute_output --partial 'behind 3'
|
||||
|
||||
_reset_recipe
|
||||
}
|
||||
|
||||
@test "detect backup labels" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" --debug
|
||||
assert_failure
|
||||
assert_output --partial 'no containers matching'
|
||||
|
||||
assert_output --partial 'detected backup paths'
|
||||
assert_output --partial 'detected pre-hook command'
|
||||
assert_output --partial 'detected post-hook command'
|
||||
}
|
||||
|
||||
@test "error if backups not enabled" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run sed -i '/backupbot.backup=true/d' "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"
|
||||
assert_success
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" app --chaos
|
||||
assert_failure
|
||||
assert_output --partial 'no backup config for app'
|
||||
|
||||
_checkout_recipe
|
||||
}
|
||||
|
||||
@test "error if backup paths not configured" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run sed -i '/backupbot.backup.path=.*/d' "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"
|
||||
assert_success
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" app --chaos
|
||||
assert_failure
|
||||
assert_output --partial 'backup paths are empty for app?'
|
||||
|
||||
_checkout_recipe
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "backup single service" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
_deploy_app
|
||||
|
||||
run $ABRA app backup "$TEST_APP_DOMAIN" app
|
||||
assert_success
|
||||
assert_output --partial 'running backup for the app service'
|
||||
|
||||
sanitisedDomainName="${TEST_APP_DOMAIN//./_}"
|
||||
assert_output --partial "_$sanitisedDomainName_app"
|
||||
|
||||
assert_exists "$ABRA_DIR/backups"
|
||||
assert bash -c "ls $ABRA_DIR/backups | grep -q $1_$sanitisedDomainName_app"
|
||||
|
||||
_undeploy_app
|
||||
}
|
@ -26,11 +26,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app check
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app check DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "retrieve recipe if missing" {
|
||||
|
@ -24,32 +24,12 @@ teardown(){
|
||||
_undeploy_app
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "autocomplete" {
|
||||
run $ABRA app cmd --generate-bash-completion
|
||||
assert_success
|
||||
assert_output "$TEST_APP_DOMAIN"
|
||||
|
||||
run $ABRA app cmd "$TEST_APP_DOMAIN" --generate-bash-completion
|
||||
assert_success
|
||||
assert_output "app"
|
||||
|
||||
run $ABRA app cmd "$TEST_APP_DOMAIN" app --generate-bash-completion
|
||||
assert_success
|
||||
assert_output "test_cmd
|
||||
test_cmd_arg
|
||||
test_cmd_args
|
||||
test_cmd_export"
|
||||
}
|
||||
|
||||
@test "validate app argument" {
|
||||
run $ABRA app cmd
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app cmd DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "retrieve recipe if missing" {
|
||||
@ -123,13 +103,11 @@ test_cmd_export"
|
||||
@test "error if missing arguments without passing --local" {
|
||||
run $ABRA app cmd "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'missing arguments'
|
||||
}
|
||||
|
||||
@test "error if missing arguments when passing --local" {
|
||||
run $ABRA app cmd --local "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'missing arguments'
|
||||
}
|
||||
|
||||
@test "cannot use --local and --user at same time" {
|
||||
@ -162,17 +140,13 @@ test_cmd_export"
|
||||
}
|
||||
|
||||
@test "run command with single arg" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/581"
|
||||
|
||||
run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd_arg -- bing
|
||||
assert_success
|
||||
assert_output --partial 'bing'
|
||||
}
|
||||
|
||||
@test "run command with several args" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/581"
|
||||
|
||||
run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd_args -- bong bang
|
||||
run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd_args bong bang
|
||||
assert_success
|
||||
assert_output --partial 'bong bang'
|
||||
}
|
||||
|
@ -18,9 +18,7 @@ setup(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app config
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app config DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
@ -29,21 +29,17 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app cp
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app cp DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "error if missing src/dest arguments" {
|
||||
run $ABRA app cp "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'missing <src> argument'
|
||||
|
||||
run $ABRA app cp "$TEST_APP_DOMAIN" myfile.txt
|
||||
assert_failure
|
||||
assert_output --partial 'missing <dest> argument'
|
||||
}
|
||||
|
||||
@test "either src/dest has correct syntax" {
|
||||
@ -159,7 +155,7 @@ teardown(){
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "copy container file to local directory" {
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app bash -c "echo foo > /etc/myfile.txt"
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- bash -c "echo foo > /etc/myfile.txt"
|
||||
assert_success
|
||||
|
||||
run $ABRA app cp "$TEST_APP_DOMAIN" app:/etc/myfile.txt "$BATS_TMPDIR"
|
||||
@ -170,7 +166,7 @@ teardown(){
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "copy container file to local file" {
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app bash -c "echo foo > /etc/myfile.txt"
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- bash -c "echo foo > /etc/myfile.txt"
|
||||
assert_success
|
||||
|
||||
run $ABRA app cp "$TEST_APP_DOMAIN" app:/etc/myfile.txt "$BATS_TMPDIR/myfile.txt"
|
||||
@ -181,7 +177,7 @@ teardown(){
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "copy container file to local file and rename" {
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app bash -c "echo foo > /etc/myfile.txt"
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- bash -c "echo foo > /etc/myfile.txt"
|
||||
assert_success
|
||||
|
||||
run $ABRA app cp "$TEST_APP_DOMAIN" app:/etc/myfile.txt "$BATS_TMPDIR/myfile2.txt"
|
||||
@ -192,10 +188,10 @@ teardown(){
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "copy container directory to local directory" {
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app bash -c "echo foo > /etc/myfile.txt"
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- bash -c "echo foo > /etc/myfile.txt"
|
||||
assert_success
|
||||
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app bash -c "echo bar > /etc/myfile2.txt"
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- bash -c "echo bar > /etc/myfile2.txt"
|
||||
assert_success
|
||||
|
||||
mkdir "$BATS_TMPDIR/mydir"
|
||||
@ -209,10 +205,10 @@ teardown(){
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "copy container files to local directory" {
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app bash -c "echo foo > /etc/myfile.txt"
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- bash -c "echo foo > /etc/myfile.txt"
|
||||
assert_success
|
||||
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app bash -c "echo bar > /etc/myfile2.txt"
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- bash -c "echo bar > /etc/myfile2.txt"
|
||||
assert_success
|
||||
|
||||
mkdir "$BATS_TMPDIR/mydir"
|
||||
|
@ -32,11 +32,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app deploy
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app deploy DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "bail if unstaged changes and no --chaos" {
|
||||
|
@ -20,11 +20,9 @@ setup(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app logs
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app logs DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "error if not deployed" {
|
||||
|
@ -22,12 +22,6 @@ teardown(){
|
||||
_reset_recipe
|
||||
}
|
||||
|
||||
@test "autocomplete" {
|
||||
run $ABRA app new --generate-bash-completion
|
||||
assert_success
|
||||
assert_output --partial "traefik"
|
||||
}
|
||||
|
||||
@test "create new app" {
|
||||
run $ABRA app new "$TEST_RECIPE" \
|
||||
--no-input \
|
||||
|
@ -24,11 +24,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app ps
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app ps DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
|
@ -28,11 +28,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app deploy
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app deploy DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "do not show ALERTA warning if --force / --no-input" {
|
||||
|
@ -24,17 +24,14 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app restart
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app restart DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "error if service missing" {
|
||||
run $ABRA app restart "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'missing <service>'
|
||||
}
|
||||
|
||||
@test "error if not deployed" {
|
||||
|
@ -1,272 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
setup_file(){
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
_add_server
|
||||
_new_app
|
||||
}
|
||||
|
||||
teardown_file(){
|
||||
_rm_app
|
||||
_rm_server
|
||||
_reset_recipe
|
||||
}
|
||||
|
||||
setup(){
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
}
|
||||
|
||||
teardown(){
|
||||
_undeploy_app
|
||||
}
|
||||
|
||||
@test "validate app argument" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run $ABRA app restore
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app restore DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "retrieve recipe if missing" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
assert_success
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app DOESNTEXIST
|
||||
assert_failure
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
|
||||
}
|
||||
|
||||
@test "bail if unstaged changes and no --chaos" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_success
|
||||
assert_output --partial 'foo'
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'locally unstaged changes'
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
_checkout_recipe
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "do not bail if unstaged changes and --chaos" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run bash -c 'echo "unstaged changes" >> "$ABRA_DIR/recipes/$TEST_RECIPE/foo"'
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_success
|
||||
assert_output --partial 'foo'
|
||||
|
||||
run touch "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.txt"
|
||||
|
||||
run tar -cvf "$BATS_TMPDIR/foo.tar.gz" "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.tar.gz"
|
||||
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" --chaos --no-input
|
||||
assert_success
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app "$BATS_TMPDIR/foo.tar.gz" \
|
||||
--debug --chaos
|
||||
assert_success
|
||||
assert_output --partial 'restore config detected'
|
||||
assert_output --partial 'detected pre-hook command'
|
||||
assert_output --partial 'detected post-hook command'
|
||||
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app ls "$BATS_TMPDIR"
|
||||
assert_success
|
||||
assert_output --partial 'foo.txt'
|
||||
|
||||
_undeploy_app
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
_checkout_recipe
|
||||
}
|
||||
|
||||
@test "ensure recipe up to date if no --offline" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --regexp 'behind .* 3 commits'
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app
|
||||
assert_failure
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --partial "up to date"
|
||||
}
|
||||
|
||||
@test "ensure recipe not up to date if --offline" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)"
|
||||
refute [ -z "$latestCommit" ];
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --regexp 'behind .* 3 commits'
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app --offline
|
||||
assert_failure
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --regexp 'behind .* 3 commits'
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$latestCommit"
|
||||
assert_success
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_output --partial "HEAD detached at $latestCommit"
|
||||
}
|
||||
|
||||
@test "error if missing service" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'missing <service>'
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app
|
||||
assert_failure
|
||||
assert_output --partial 'missing <file>'
|
||||
}
|
||||
|
||||
@test "error if file doesn't exist" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial "doesn't exist"
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "detect labels if restore enabled" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run touch "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.txt"
|
||||
|
||||
run tar -cvf "$BATS_TMPDIR/foo.tar.gz" "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.tar.gz"
|
||||
|
||||
_deploy_app
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app "$BATS_TMPDIR/foo.tar.gz" --debug
|
||||
assert_success
|
||||
assert_output --partial 'restore config detected'
|
||||
assert_output --partial 'detected pre-hook command'
|
||||
assert_output --partial 'detected post-hook command'
|
||||
|
||||
_undeploy_app
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "no error if restore not enabled" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run sed -i '/backupbot.restore=.*/d' "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"
|
||||
assert_success
|
||||
|
||||
run touch "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.txt"
|
||||
|
||||
run tar -cvf "$BATS_TMPDIR/foo.tar.gz" "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.tar.gz"
|
||||
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --chaos
|
||||
assert_success
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app "$BATS_TMPDIR/foo.tar.gz" \
|
||||
--debug --chaos
|
||||
assert_success
|
||||
refute_output --partial 'restore config detected'
|
||||
refute_output --partial 'detected pre-hook command'
|
||||
refute_output --partial 'detected post-hook command'
|
||||
|
||||
_undeploy_app
|
||||
|
||||
_checkout_recipe
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "error if service doesn't exist" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run touch "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.txt"
|
||||
|
||||
run tar -cvf "$BATS_TMPDIR/foo.tar.gz" "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.tar.gz"
|
||||
|
||||
_deploy_app
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" DOESNTEXIST "$BATS_TMPDIR/foo.tar.gz" --debug
|
||||
assert_failure
|
||||
assert_output --partial 'no containers matching'
|
||||
|
||||
_undeploy_app
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "restore backup" {
|
||||
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
|
||||
|
||||
run touch "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.txt"
|
||||
|
||||
run tar -cvf "$BATS_TMPDIR/foo.tar.gz" "$BATS_TMPDIR/foo.txt"
|
||||
assert_success
|
||||
assert_exists "$BATS_TMPDIR/foo.tar.gz"
|
||||
|
||||
_deploy_app
|
||||
|
||||
run $ABRA app restore "$TEST_APP_DOMAIN" app "$BATS_TMPDIR/foo.tar.gz" --debug
|
||||
assert_success
|
||||
assert_output --partial 'restore config detected'
|
||||
assert_output --partial 'detected pre-hook command'
|
||||
assert_output --partial 'detected post-hook command'
|
||||
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app ls "$BATS_TMPDIR"
|
||||
assert_success
|
||||
assert_output --partial 'foo.txt'
|
||||
|
||||
_undeploy_app
|
||||
}
|
@ -26,11 +26,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app rollback
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app rollback DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "retrieve recipe if missing" {
|
||||
|
@ -24,21 +24,17 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app run
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app run DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "error if missing service" {
|
||||
run $ABRA app run "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'no <service> provided'
|
||||
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app
|
||||
assert_failure
|
||||
assert_output --partial 'no <args> provided'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@ -54,7 +50,7 @@ teardown(){
|
||||
@test "run command" {
|
||||
_deploy_app
|
||||
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app ls /
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- ls /
|
||||
assert_success
|
||||
assert_output --partial 'root'
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ teardown(){
|
||||
@test "generate: validate arguments" {
|
||||
run $ABRA app secret generate
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app secret generate DOESNTEXIST
|
||||
assert_failure
|
||||
@ -43,7 +42,6 @@ teardown(){
|
||||
|
||||
run $ABRA app secret generate "$TEST_APP_DOMAIN"
|
||||
assert_failure
|
||||
assert_output --partial 'missing arguments'
|
||||
|
||||
run $ABRA app secret generate "$TEST_APP_DOMAIN" testSecret testVersion --all
|
||||
assert_failure
|
||||
@ -89,7 +87,6 @@ teardown(){
|
||||
run $ABRA app secret generate "$TEST_APP_DOMAIN" --all
|
||||
assert_failure
|
||||
assert_output --partial 'missing version'
|
||||
|
||||
}
|
||||
|
||||
@test "generate: use version from app env" {
|
||||
|
@ -25,11 +25,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app services
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app services DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "error if not deployed" {
|
||||
|
@ -25,11 +25,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app undeploy
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app undeploy DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
|
@ -26,11 +26,9 @@ teardown(){
|
||||
@test "validate app argument" {
|
||||
run $ABRA app upgrade
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app upgrade DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
|
@ -24,11 +24,9 @@ teardown(){
|
||||
@test "ls validate app argument" {
|
||||
run $ABRA app volume ls
|
||||
assert_failure
|
||||
assert_output --partial 'no app provided'
|
||||
|
||||
run $ABRA app volume ls DOESNTEXIST
|
||||
assert_failure
|
||||
assert_output --partial 'cannot find app'
|
||||
}
|
||||
|
||||
@test "list no volumes" {
|
||||
|
@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
setup(){
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
}
|
||||
|
||||
@test "bash autocompletion" {
|
||||
run $ABRA autocomplete bash
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/autocompletion/bash"
|
||||
}
|
||||
|
||||
@test "zsh autocompletion" {
|
||||
run $ABRA autocomplete zsh
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/autocompletion/zsh"
|
||||
}
|
||||
|
||||
@test "fish autocompletion" {
|
||||
run $ABRA autocomplete fish
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/autocompletion/fish"
|
||||
}
|
||||
|
||||
@test "fizsh autocompletion" {
|
||||
run $ABRA autocomplete fizsh
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/autocompletion/zsh"
|
||||
}
|
@ -4,7 +4,7 @@ _mkfile() {
|
||||
}
|
||||
|
||||
_mkfile_remote() {
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app "bash -c \"echo $2 > $1\""
|
||||
run $ABRA app run "$TEST_APP_DOMAIN" app -- "bash -c \"echo $2 > $1\""
|
||||
assert_success
|
||||
}
|
||||
|
||||
@ -19,6 +19,6 @@ _rm() {
|
||||
}
|
||||
|
||||
_rm_remote() {
|
||||
run "$ABRA" app run "$TEST_APP_DOMAIN" app rm -rf "$1"
|
||||
run "$ABRA" app run "$TEST_APP_DOMAIN" app -- rm -rf "$1"
|
||||
assert_success
|
||||
}
|
||||
|
@ -25,11 +25,9 @@ teardown() {
|
||||
@test "validate recipe argument" {
|
||||
run $ABRA recipe release --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'no recipe name provided'
|
||||
|
||||
run $ABRA recipe release DOESNTEXIST --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'unable to clone DOESNTEXIST'
|
||||
}
|
||||
|
||||
@test "release patch bump" {
|
||||
|
@ -24,11 +24,9 @@ teardown(){
|
||||
@test "validate recipe argument" {
|
||||
run $ABRA recipe sync --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'no recipe name provided'
|
||||
|
||||
run $ABRA recipe sync DOESNTEXIST --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'unable to clone DOESNTEXIST'
|
||||
}
|
||||
|
||||
@test "allow unstaged changes" {
|
||||
|
@ -24,11 +24,9 @@ teardown(){
|
||||
@test "validate recipe argument" {
|
||||
run $ABRA recipe upgrade --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'no recipe name provided'
|
||||
|
||||
run $ABRA recipe upgrade DOESNTEXIST --no-input
|
||||
assert_failure
|
||||
assert_output --partial 'unable to clone DOESNTEXIST'
|
||||
}
|
||||
|
||||
@test "retrieve recipe if missing" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user