test failure: org.opennms.netmgt.poller.monitors.DnsMonitorTest
Description
java.lang.AssertionError: null at org.junit.Assert.fail(Assert.java:92) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:526) at org.junit.Assert.assertNotNull(Assert.java:537) at org.opennms.netmgt.poller.monitors.DnsMonitorTest.testNoAnswer(DnsMonitorTest.java:266)
Acceptance / Success Criteria
None
Lucidchart Diagrams
Activity
Show:
Matt Brozowski September 13, 2014 at 12:05 PM
Fixed this in Git revision
ce75646f2932c88866ca9f44c20a6ed13962d55c
Matt Brozowski September 13, 2014 at 12:04 PM
I spent some time trying to figure this issue out.
The issue was the static DNS query cache inside dnsjava was interacting with the results. Additionally the correct result was the one causing the failure. When attempting to resolve example.com against a DNS Server with no zones. A Successful result is not the correct one. Instead we should get a NXRRSET response which results in a null getAnswers().
I have changed all the tests that use the Lookup class to setCache(null) to avoid this problem and have commit the fix to master in commit
ce75646f2932c88866ca9f44c20a6ed13962d55c
Matt Brozowski September 13, 2014 at 9:01 AM
java.lang.AssertionError: null at org.junit.Assert.fail(Assert.java:92) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:526) at org.junit.Assert.assertNotNull(Assert.java:537) at org.opennms.netmgt.poller.monitors.DnsMonitorTest.testNoAnswer(DnsMonitorTest.java:266)
I changed the JUnit DNS server to explicitly wait for the TCP/UDP listening threads to come up before start() returns. This will (hopefully) fix the startup race condition that potentially caused intermittent DNS-related test failures.