Repository navigation
Return 534 when a network restart fails on an unavailable resource - #14632
bhouse-nexthop wants to merge 1 commit into
Conversation
RestartNetworkCmd.execute() let ResourceUnavailableException, ConcurrentOperationException and InsufficientCapacityException reach the async job dispatcher, which logs them at ERROR as "Unexpected exception while executing" and fails the job with 530. RestartVPCCmd catches the same exceptions and maps them to ServerApiException, so a refused restartVPC fails with 534 and a WARN line. Catch them in RestartNetworkCmd the same way: 534 for ResourceUnavailableException, 530 for ConcurrentOperationException and 533 for InsufficientCapacityException, each with the exception message. Signed-off-by: Brad House <bhouse@nexthop.ai>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14632 +/- ##
==========================================
Coverage 18.32% 18.33%
- Complexity 16644 16659 +15
==========================================
Files 5939 5939
Lines 537768 537940 +172
Branches 65929 65994 +65
==========================================
+ Hits 98551 98624 +73
- Misses 428008 428100 +92
- Partials 11209 11216 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Test report: restartNetwork refused because the router's host is DisconnectedSummary: Environment
Steps
Results
Result: pass. Not covered: the |
Description
This PR makes
restartNetworkreport a failed restart the wayrestartVPCdoes.RestartNetworkCmd.execute()letResourceUnavailableException,ConcurrentOperationExceptionandInsufficientCapacityExceptionreach the async job dispatcher. The dispatcher logs those at ERROR asUnexpected exception while executing ... RestartNetworkCmdand fails the job with 530.RestartVPCCmdcatches them and throws aServerApiExceptioninstead.RestartNetworkCmd.execute()now catches them in the same way, with the same logging:ResourceUnavailableException: error code 534 (RESOURCE_UNAVAILABLE_ERROR), logged at WARN;ConcurrentOperationException: 530 (INTERNAL_ERROR), logged at WARN;InsufficientCapacityException: 533 (INSUFFICIENT_CAPACITY_ERROR).The error text is the exception message in each case, as before. A restart that returns
falsestill fails with 530 andFailed to restart network.Fixes: #14631
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
RestartNetworkCmdTest(mvn -pl api -am test -Dtest=RestartNetworkCmdTest), 5 tests, all pass: success response;falsefrom the service gives 530; each of the three exceptions gives the error code listed above with the exception message.restartNetworkfailed with 530 and an ERROR stack trace, while the matchingrestartVPCfailed with 534 and a WARN line. This change has not been run in that lab; the behaviour is covered by the unit tests.How did you try to break this feature and the system with this change?
Checked that nothing else calls
RestartNetworkCmd.execute()and relies on the checked exceptions it declared; the API dispatcher is the only caller.