question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[network] failing tests

See original GitHub issue

On Mac Os the new network tests are failing:

Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.13 sec <<< FAILURE! - in org.openhab.binding.network.internal.PresenceDetectionTest
partialAndFinalCallbackTests(org.openhab.binding.network.internal.PresenceDetectionTest)  Time elapsed: 0.042 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at org.openhab.binding.network.internal.PresenceDetectionTest.setUp(PresenceDetectionTest.java:78)

cacheTest(org.openhab.binding.network.internal.PresenceDetectionTest)  Time elapsed: 0.025 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at org.openhab.binding.network.internal.PresenceDetectionTest.setUp(PresenceDetectionTest.java:78)

reuseValueTests(org.openhab.binding.network.internal.PresenceDetectionTest)  Time elapsed: 0.022 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at org.openhab.binding.network.internal.PresenceDetectionTest.setUp(PresenceDetectionTest.java:78)

threadCountTest(org.openhab.binding.network.internal.PresenceDetectionTest)  Time elapsed: 0.024 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at org.openhab.binding.network.internal.PresenceDetectionTest.setUp(PresenceDetectionTest.java:78)

Running org.openhab.binding.network.internal.PresenceDetectionValuesTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec - in org.openhab.binding.network.internal.PresenceDetectionValuesTest
updateLatencyTests(org.openhab.binding.network.internal.PresenceDetectionValuesTest)  Time elapsed: 0 sec
pingTests(org.openhab.binding.network.internal.PresenceDetectionValuesTest)  Time elapsed: 0.006 sec
isFinishedTests(org.openhab.binding.network.internal.PresenceDetectionValuesTest)  Time elapsed: 0 sec
tcpTests(org.openhab.binding.network.internal.PresenceDetectionValuesTest)  Time elapsed: 0.001 sec
Running org.openhab.binding.network.internal.utils.NetworkUtilsTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in org.openhab.binding.network.internal.utils.NetworkUtilsTest
testInterfaceIPS(org.openhab.binding.network.internal.utils.NetworkUtilsTest)  Time elapsed: 0.003 sec
testConvertMethods(org.openhab.binding.network.internal.utils.NetworkUtilsTest)  Time elapsed: 0 sec
Running org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.129 sec - in org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest
testConstructorWrongCacheTime(org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest)  Time elapsed: 0.001 sec
testExpiring(org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest)  Time elapsed: 0.11 sec
testConstructorNoRefrehCommand(org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest)  Time elapsed: 0 sec
testFetchValue(org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest)  Time elapsed: 0.012 sec
testFetchExpiredValue(org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest)  Time elapsed: 0.003 sec

Results :

Failed tests: 
  PresenceDetectionTest.setUp:78 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>
  PresenceDetectionTest.setUp:78 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>
  PresenceDetectionTest.setUp:78 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>
  PresenceDetectionTest.setUp:78 
Expected: is <SYSTEM_PING>
     but: was <JAVA_PING>

Tests run: 24, Failures: 4, Errors: 0, Skipped: 0

Which is not completely surprising given the code:

public void setPingMethod(PresenceDetection.PingMethod pingMethod) {
    if (pingMethod == PresenceDetection.PingMethod.SYSTEM_PING && !this.networkUtils.isNativePingWorking()) {
        pingMethod = PresenceDetection.PingMethod.JAVA_PING;
    }

    this.pingMethod = pingMethod;
}

@davidgraeff can you please look into this

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
davidgraeffcommented, Aug 22, 2017

@martinvw Solution would be a special case (org.apache.commons.lang3.SystemUtils.IS_OS_MAC) for MacOS and using an uppercase “W” instead of a lowercase “w” argument, I guess?

Alternatively, the ping util is feature checked when the binding is started.

0reactions
svilenvulcommented, Aug 25, 2017

I have also a test failure:

testExpiring(org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest)  Time elapsed: 0.109 sec  <<< FAILURE!
org.mockito.exceptions.verification.WantedButNotInvoked:
Wanted but not invoked:
expiringCacheUpdate.requestCacheUpdate();
-> at org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest.testExpiring(ExpiringCacheAsyncTest.java:81)
Actually, there were zero interactions with this mock.

        at org.openhab.binding.network.toberemoved.cache.ExpiringCacheAsyncTest.testExpiring(ExpiringCacheAsyncTest.java:81)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do You Conduct Network Failure Testing? - NetCraftsmen
Good failure testing requires an investment in time and planning. But it delivers good rewards in understanding how your network reacts to failures...
Read more >
How to Conduct a Network Stability Test - Comparitech
We show you how to conduct a network stability test using both command line and professional tools. Learn what to look out for...
Read more >
Network issues simulation: How to test against bad ... - Medium
Network issues simulation: How to test against bad network conditions ... This particular article would be devoted to network failure ...
Read more >
5 Types of Network Failures and How to Prevent Them
Networks are complicated, and the number of things THAT can go wrong is staggering. We have compiled a list of 5 network failure...
Read more >
Testing my connection fails
You might have a problem with your Internet connection. Try visiting a website with your web browser to test this. You can try...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found