From 7de160b64d985192fdc2710d392f004c362cb60b Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 10 May 2016 09:30:55 -0700 Subject: [PATCH] add test for ps:restore with undeployed app. refs #2171 --- tests/unit/10_ps-herokuish.bats | 52 ++++++++++++++++++++++++++------- tests/unit/test_helper.bash | 2 ++ 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/tests/unit/10_ps-herokuish.bats b/tests/unit/10_ps-herokuish.bats index cd2ccbfda..1e478c5d9 100644 --- a/tests/unit/10_ps-herokuish.bats +++ b/tests/unit/10_ps-herokuish.bats @@ -8,18 +8,19 @@ setup() { teardown() { destroy_app + destroy_app 0 "$MYAPP" || true } -# @test "(ps) herokuish" { -# # CI support: 'Ah. I just spoke with our Docker expert -- -# # looks like docker exec is built to work with docker-under-libcontainer, -# # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry -# skip "circleci does not support docker exec at the moment." -# run bash -c "dokku ps $TEST_APP | grep -q \"node web.js\"" -# echo "output: "$output -# echo "status: "$status -# assert_success -# } +@test "(ps) herokuish" { + # CI support: 'Ah. I just spoke with our Docker expert -- + # looks like docker exec is built to work with docker-under-libcontainer, + # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry + skip "circleci does not support docker exec at the moment." + run bash -c "dokku ps $TEST_APP | grep -q \"node web.js\"" + echo "output: "$output + echo "status: "$status + assert_success +} @test "(ps) herokuish" { deploy_app @@ -123,3 +124,34 @@ teardown() { assert_success done } + +@test "(ps:restore) herokuish" { + MYAPP="manual-randomtestapp-1" + create_app "$MYAPP" + deploy_app + + run bash -c "dokku ps:stop $TEST_APP" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku apps" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku ps:restore" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku ls" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku --quiet ls | grep $TEST_APP | grep -q running" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 96414e1ce..4d77f3f51 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -113,11 +113,13 @@ assert_exit_status() { # dokku functions create_app() { + local APP="$1"; local TEST_APP=${APP:=$TEST_APP} dokku apps:create "$TEST_APP" } destroy_app() { local RC="$1"; local RC=${RC:=0} + local APP="$2"; local TEST_APP=${APP:=$TEST_APP} dokku --force apps:destroy "$TEST_APP" return "$RC" }