From 72a4637beb151102e1d7aac757880d6911628c0c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 2 Apr 2020 13:05:23 -0400 Subject: [PATCH] fix: change error exit to warning when no apps exist This was a regression introduced in 0.20.0 when the plugin was converted to golang. --- plugins/apps/subcommands.go | 3 ++- tests/unit/10_apps.bats | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/plugins/apps/subcommands.go b/plugins/apps/subcommands.go index 6e06573ea..88d487c3a 100644 --- a/plugins/apps/subcommands.go +++ b/plugins/apps/subcommands.go @@ -108,7 +108,8 @@ func CommandList(args []string) error { common.LogInfo2Quiet("My Apps") apps, err := common.DokkuApps() if err != nil { - return err + common.LogWarn(err.Error()) + return nil } for _, appName := range apps { diff --git a/tests/unit/10_apps.bats b/tests/unit/10_apps.bats index 210e7a26e..82ce74dc4 100644 --- a/tests/unit/10_apps.bats +++ b/tests/unit/10_apps.bats @@ -24,6 +24,32 @@ teardown() { assert_output "$help_output" } +@test "(apps) apps:list" { + run /bin/bash -c "dokku apps:list 2>&1" + echo "output: $output" + echo "status: $status" + assert_success + assert_output_contains "You haven't deployed any applications yet" + assert_output_contains "$TEST_APP" 0 + + run /bin/bash -c "dokku apps:create $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku apps:list 2>&1" + echo "output: $output" + echo "status: $status" + assert_success + assert_output_contains "You haven't deployed any applications yet" 0 + assert_output_contains "$TEST_APP" + + run /bin/bash -c "dokku --force apps:destroy $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success +} + @test "(apps) apps:create" { run /bin/bash -c "dokku apps:create $TEST_APP" echo "output: $output"