Hi Aleksei,
If that solves the issue, then LGTM!
best regards,
-- daniel
On 07/05/2020 14:57, Aleks Efimov wrote:
Hi Daniel,
As a follow-up to our off-list discussion, I've updated the
generateUnseenPort method:
a) Added comment to be more specific about the number of times it is called
b) The port range has been extended to [1111, PortConfig.getUpper())
Webrev with new version:
http://cr.openjdk.java.net/~aefimov/8237834/01
With Best Regards,
Aleksei
On 07/05/2020 11:10, Daniel Fuchs wrote:
Hi Aleksei,
I agree with the general idea. However, the method:
215 private static int generateUnseenPort() {
216 int port;
217 do {
218 port = 1111 + RND.nextInt(1000);
219 } while (SEEN_PORTS.contains(port));
220 SEEN_PORTS.add(port);
221 return port;
222 }
might never return - if none of the port in the range
[1111, 2111] are free. Arguably, the test will have
failed in timeout before that. But maybe an assertion
error should be thrown if that happens.
best regards,
-- daniel
On 07/05/2020 00:52, Aleks Efimov wrote:
Hi,
LdapDnsProviderTest test expects to have no services running on 1111
port on test machine. That could cause it to fail intermittently due
to unexpected exception message thrown by LDAP client, i.e. timeout
or disconnect instead of expected connection refusal.
The proposed fix tries to make test more stable ('intermittent' key
was still added) by running test cases with non-default port multiple
times by trying to use different random port numbers ('randomness'
key was added) for each run.
Webrev: http://cr.openjdk.java.net/~aefimov/8237834/00/index.html
JBS: https://bugs.openjdk.java.net/browse/JDK-8237834
Test was not observed to fail for over 300 iterations.
With Best Regards,
Aleksei