cloudstack
cloudstack copied to clipboard
Refactor TestHttp.testHttpclient to avoid the Exception Suppression
Description
FIX #6673
This PR removes the catch block with the e.printStackTrace(), which suppressed the Exceptions to be thrown in the CI\CD's final report.
These catch blocks will only print the the Exception information and will not raise any failure in the testing process. This behavior will lead the developer harder to notice the issue in the CI\CD reports.
I suggest removing the try-catch structure and adding some additional assertion(if possible). This will improve the readability of the test cases, and avoid missing the test failure. Even if the exception does not raise by the component that we are testing here, we can still know that we need to fix the outside conditions first to make sure the test case running under stable and consistent conditions.
Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
- [ ] Major
- [x] Minor
How Has This Been Tested?
Local cluster environment (KVM, UBUNTU 18.04) runs the test suite.
@Codegass is this test actually run? as it is in a package called org.apache.cloudstack.storage.test; and in a project called engine/storage/integration-test I doubt that it is and a cleanup would require more action.
Codecov Report
Merging #6733 (f1aff02) into main (68c09f9) will increase coverage by
0.00%. The diff coverage isn/a.
@@ Coverage Diff @@
## main #6733 +/- ##
=========================================
Coverage 10.41% 10.41%
- Complexity 6685 6686 +1
=========================================
Files 2454 2454
Lines 242975 242975
Branches 38036 38036
=========================================
+ Hits 25305 25307 +2
+ Misses 214508 214507 -1
+ Partials 3162 3161 -1
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...apache/cloudstack/alert/snmp/SnmpTrapAppender.java | 58.94% <0.00%> (-2.11%) |
:arrow_down: |
| ...apache/cloudstack/syslog/AlertsSyslogAppender.java | 58.75% <0.00%> (+2.25%) |
:arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@Codegass is this test actually run? as it is in a package called
org.apache.cloudstack.storage.test;and in a project calledengine/storage/integration-testI doubt that it is and a cleanup would require more action.
@DaanHoogland Hi Daan, Thank you for the notice. You are correct, I just run the overall test suite and missed the single test of itself. Please allow me to dig a little bit.
@blueorangutan package
@rohityadavcloud a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
On second look, the changes are in (unit) test code and Travis has passed.
Awesome work, congrats on your first merged pull request!







