paulazomig opened a new pull request #5905:
URL: https://github.com/apache/cloudstack/pull/5905


   ### Description
   
   This PR address the `UriUtilsParametrizedTest` need for Internet connection. 
The unit tests of the class `UriUtilsParametrizedTest` will fail when they are 
executed without a connection to the Internet. That happens because of the 
method `getByName` from `InetAdress` class (that, given the host's name, 
determines its IP address). Therefore, if one executes the build in a network 
that does not allow Internet access, or if some DNS configuration is not 
resolving the configure DNS name in the tests, the tests fail. The goal of the 
test in that class is not to test DNS, but the validation of the accepted 
formats. Therefore, we should not depend on DNS, Internet connection, and 
others.
   
   This PR proposes to solve that problem by mocking the object for the 
`InetAdress` class. That way, when the `getByName` method is called, the mocked 
object is returned and the tests can proceed normally without needing a healthy 
and working DNS or Internet connection to use some Internet DNS system. 
   
   ### 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
   
   #### Bug Severity
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [X] Minor
   - [ ] Trivial
   
   ### How Has This Been Tested?
   I ran the unit tests from the `UriUtilsParametrizedTest` class, before this 
PR, and without an Internet connection, the tests failed. Afterwards, I ran the 
tests again (with this PR), without an Internet connection, and they all passed 
as expected. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to