From 4a6d3c25a4ad4b8dfa786c7c34de9c7445950460 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 8 Apr 2019 13:55:23 -0400 Subject: [PATCH] fix: do not crash when clearing properties --- plugins/resource/subcommands.go | 10 ++-------- tests/unit/20_resource.bats | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/plugins/resource/subcommands.go b/plugins/resource/subcommands.go index fcb90be0d..568f0a769 100644 --- a/plugins/resource/subcommands.go +++ b/plugins/resource/subcommands.go @@ -63,10 +63,7 @@ func clearByRequestType(appName string, processType string, requestType string) return err } for key := range resources { - err := common.PropertyDelete("resource", appName, key) - if err != nil { - return err - } + common.PropertyDelete("resource", appName, key) } } else { resources := []string{ @@ -80,10 +77,7 @@ func clearByRequestType(appName string, processType string, requestType string) for _, key := range resources { property := propertyKey(processType, requestType, key) - err := common.PropertyDelete("resource", appName, property) - if err != nil { - return err - } + common.PropertyDelete("resource", appName, property) } } return nil diff --git a/tests/unit/20_resource.bats b/tests/unit/20_resource.bats index 372fad236..38b8729c8 100644 --- a/tests/unit/20_resource.bats +++ b/tests/unit/20_resource.bats @@ -135,3 +135,27 @@ teardown() { echo "status: $status" assert_output "0" } + +@test "(docker-options) resource:limit-clear" { + run /bin/bash -c "dokku resource:limit-clear $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku resource:limit-clear --process-type web $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success +} + +@test "(docker-options) resource:reserve-clear" { + run /bin/bash -c "dokku resource:reserve-clear $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku resource:reserve-clear --process-type web $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success +}