fix: do not crash when clearing properties

This commit is contained in:
Jose Diaz-Gonzalez
2019-04-08 13:55:23 -04:00
parent beef464cc1
commit 4a6d3c25a4
2 changed files with 26 additions and 8 deletions

View File

@@ -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

View File

@@ -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
}