GitHub user ottobackwards opened a pull request: https://github.com/apache/metron/pull/924
METRON-1299 In MetronError tests, don't test for HostName if getHostName wouldn't work MetronError ignores exceptions from InetAddress.getLocalHost().getHostName() and leaves the field unset. The unit test however assumes it would be set, and someone has logged a jira on this, since it makes the build fail. Changed the test so that it only verifies the hostName if it would have worked. ### Testing - Code review - Tests Pass > no non-test changes in pr ```java private void addHostname(JSONObject errorMessage) { try { errorMessage.put(ErrorFields.HOSTNAME.getName(), InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException ex) { // Leave the hostname field off if it cannot be found } } ``` ### For all changes: - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? You can merge this pull request into a Git repository by running: $ git pull https://github.com/ottobackwards/metron error_addHost Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metron/pull/924.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #924 ---- commit cee3acba914f97ca7d2faf6e7822c97928a4e242 Author: Otto Fowler <ottobackwards@...> Date: 2018-02-02T21:57:47Z do not test for hostName if calling hostName throws, since it will be null ---- ---