From 929c98ee90f42a93b73613c5c5b24ae0add391ea Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 9 Apr 2019 02:41:02 -0400 Subject: [PATCH 1/2] fix: ensure 'dokku report' always succeeds for any app --- plugins/buildpacks/.gitignore | 1 + plugins/resource/resource.go | 2 +- tests/unit/40_report.bats | 48 +++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/unit/40_report.bats diff --git a/plugins/buildpacks/.gitignore b/plugins/buildpacks/.gitignore index 56aebe3b7..cd4903d6f 100644 --- a/plugins/buildpacks/.gitignore +++ b/plugins/buildpacks/.gitignore @@ -3,4 +3,5 @@ /triggers/* /install /post-delete +/post-extract /report diff --git a/plugins/resource/resource.go b/plugins/resource/resource.go index bd299e58c..526589cca 100644 --- a/plugins/resource/resource.go +++ b/plugins/resource/resource.go @@ -29,7 +29,7 @@ func ReportSingleApp(appName, infoFlag string) { resources, err := common.PropertyGetAll("resource", appName) if err != nil { - common.LogFail(err.Error()) + return } flags := []string{} diff --git a/tests/unit/40_report.bats b/tests/unit/40_report.bats new file mode 100644 index 000000000..c2fcec125 --- /dev/null +++ b/tests/unit/40_report.bats @@ -0,0 +1,48 @@ +#!/usr/bin/env bats + +load test_helper + +setup() { + global_setup + deploy_app +} + +teardown() { + destroy_app + global_teardown +} + +@test "(buildpacks) report" { + run /bin/bash -c "dokku report" + echo "output: $output" + echo "status: $status" + assert_output_contains "herokuish version:" + assert_success + + run /bin/bash -c "dokku report $TEST_APP 2>&1" + echo "output: $output" + echo "status: $status" + assert_output_contains "herokuish version:" + assert_output_contains "not deployed" "0" + assert_success + + run /bin/bash -c "dokku report fake-app-name" + echo "output: $output" + echo "status: $status" + assert_failure + + run /bin/bash -c "dokku report fake-app-name 2>&1" + echo "output: $output" + echo "status: $status" + assert_output_contains "App fake-app-name does not exist" + assert_failure + + dokku apps:create "${TEST_APP}-2" + run /bin/bash -c "dokku report ${TEST_APP}-2 2>&1" + echo "output: $output" + echo "status: $status" + assert_output_contains "not deployed" + assert_success + + dokku --force apps:destroy "${TEST_APP}-2" +} From ecd88fbeeb4276a0ff9e2222e9fa22b89568b3a0 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 9 Apr 2019 03:18:28 -0400 Subject: [PATCH 2/2] fix: correctly name the testcase --- tests/unit/40_report.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/40_report.bats b/tests/unit/40_report.bats index c2fcec125..a6daecec7 100644 --- a/tests/unit/40_report.bats +++ b/tests/unit/40_report.bats @@ -12,7 +12,7 @@ teardown() { global_teardown } -@test "(buildpacks) report" { +@test "(report) report" { run /bin/bash -c "dokku report" echo "output: $output" echo "status: $status"