Add "sanity check" tests for AgentClient#ping #268
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This relates to an issue that was in the original consul-client library: rickfast/consul-client#282
The issue claimed that calling AgentClient#ping resulted in a java.io.EOFException which we've never seen. But, go ahead and add an explicit test for this method. Since it is void, the best we can do here is assert that no exception is thrown when Consul is running.
Add test for successful ping and for a failed ping when Consul cannot be connected to.
The failed test is a RetryingTest that attempts to connect to Consul using a random port between 50000 and 65535. It will make up to five attempts before giving up. This should be more than enough attempts to find a port that causes a failure. I expect this to usually only make one attempt, but don't want to hard code the port, and don't want to fail in the (very unlikely) event there actually is a Consul running on the randomly selected port.