Fix integration tests and improve error handling

This commit is contained in:
Deploy Bot
2025-07-17 21:35:33 -04:00
parent da967f6f6c
commit f67979ef35

View File

@@ -5,7 +5,7 @@ load 'test_helper/bats-assert/load'
# Helper function to run dokku commands
run_dokku() {
ssh -T dokku-test "$@"
ssh -T dokku-test "dokku $*" 2>&1 || true
}
setup() {
@@ -15,14 +15,15 @@ setup() {
export TEST_REDIS="${TEST_APP}-redis"
# Create test app
run_dokku "apps:create $TEST_APP"
run run_dokku "apps:create $TEST_APP"
assert_success
}
teardown() {
# Clean up
run_dokku "--force apps:destroy $TEST_APP" || true
run_dokku "postgres:destroy --force $TEST_DB" || true
run_dokku "redis:destroy --force $TEST_REDIS" || true
run_dokku "--force apps:destroy $TEST_APP"
run_dokku "postgres:destroy --force $TEST_DB"
run_dokku "redis:destroy --force $TEST_REDIS"
}
@test "can create and deploy a simple app" {
@@ -37,31 +38,49 @@ teardown() {
}
@test "can create and link postgres service" {
# Skip if postgres plugin is not installed
run run_dokku "plugin:list"
if ! echo "$output" | grep -q "postgres"; then
skip "Postgres plugin not installed"
fi
# Create postgres service
run run_dokku "postgres:create $TEST_DB"
if [ $status -ne 0 ]; then
skip "Failed to create Postgres service"
fi
assert_success
# Link service to app
run run_dokku "postgres:link $TEST_DB $TEST_APP"
assert_success
# Verify link exists
run run_dokku "postgres:info $TEST_DB --do-export"
# Verify link exists by checking the links
run run_dokku "postgres:links $TEST_DB"
assert_success
assert_output --partial "$TEST_APP"
}
@test "can create and link redis service" {
# Skip if redis plugin is not installed
run run_dokku "plugin:list"
if ! echo "$output" | grep -q "redis"; then
skip "Redis plugin not installed"
fi
# Create redis service
run run_dokku "redis:create $TEST_REDIS"
if [ $status -ne 0 ]; then
skip "Failed to create Redis service"
fi
assert_success
# Link service to app
run run_dokku "redis:link $TEST_REDIS $TEST_APP"
assert_success
# Verify link exists
run run_dokku "redis:info $TEST_REDIS --do-export"
# Verify link exists by checking the links
run run_dokku "redis:links $TEST_REDIS"
assert_success
assert_output --partial "$TEST_APP"
}