openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[ntp] NtpOSGiTest unstable #9720

Open wborn opened 3 years ago

wborn commented 3 years ago

The following tests failed in: https://ci.openhab.org/job/PR-openHAB-Addons/1941/

TEST org.openhab.binding.ntp.test.NtpOSGiTest#testStringChannelFormatting() <<< ERROR: 
Expected: is an instance of org.openhab.core.library.types.StringType
     but: <NULL> is a org.openhab.core.types.UnDefType
java.lang.AssertionError: 
Expected: is an instance of org.openhab.core.library.types.StringType
     but: <NULL> is a org.openhab.core.types.UnDefType
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
    at org.openhab.binding.ntp.test.NtpOSGiTest.lambda$3(NtpOSGiTest.java:444)
    at org.openhab.core.test.java.JavaTest.waitForAssert(JavaTest.java:197)
    at org.openhab.core.test.java.JavaTest.waitForAssert(JavaTest.java:109)
    at org.openhab.binding.ntp.test.NtpOSGiTest.getItemState(NtpOSGiTest.java:441)
    at org.openhab.binding.ntp.test.NtpOSGiTest.testStringChannelFormatting(NtpOSGiTest.java:301)
TEST org.openhab.binding.ntp.test.NtpOSGiTest#testNullPropertyFormatting() <<< ERROR: 
Expected: is an instance of org.openhab.core.library.types.StringType
     but: <NULL> is a org.openhab.core.types.UnDefType
java.lang.AssertionError: 
Expected: is an instance of org.openhab.core.library.types.StringType
     but: <NULL> is a org.openhab.core.types.UnDefType
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
    at org.openhab.binding.ntp.test.NtpOSGiTest.lambda$3(NtpOSGiTest.java:444)
    at org.openhab.core.test.java.JavaTest.waitForAssert(JavaTest.java:197)
    at org.openhab.core.test.java.JavaTest.waitForAssert(JavaTest.java:109)
    at org.openhab.binding.ntp.test.NtpOSGiTest.getItemState(NtpOSGiTest.java:441)
    at org.openhab.binding.ntp.test.NtpOSGiTest.testNullPropertyFormatting(NtpOSGiTest.java:339)
TEST org.openhab.binding.ntp.test.NtpOSGiTest#testEmptyStringPropertyFormatting() <<< ERROR: 
Expected: is an instance of org.openhab.core.library.types.StringType
     but: <NULL> is a org.openhab.core.types.UnDefType
java.lang.AssertionError: 
Expected: is an instance of org.openhab.core.library.types.StringType
     but: <NULL> is a org.openhab.core.types.UnDefType
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
    at org.openhab.binding.ntp.test.NtpOSGiTest.lambda$3(NtpOSGiTest.java:444)
    at org.openhab.core.test.java.JavaTest.waitForAssert(JavaTest.java:197)
    at org.openhab.core.test.java.JavaTest.waitForAssert(JavaTest.java:109)
    at org.openhab.binding.ntp.test.NtpOSGiTest.getItemState(NtpOSGiTest.java:441)
    at org.openhab.binding.ntp.test.NtpOSGiTest.testEmptyStringPropertyFormatting(NtpOSGiTest.java:326)
lolodomo commented 2 years ago

@wborn : any idea if this is still relevant?

wborn commented 2 years ago

It seems to have been failing for ~6 years, see https://github.com/eclipse-archived/smarthome/issues/2345. :wink:

Maybe the issue is that sometimes the test already updates state before the items are linked to channels which is IIRC done asynchronously. I've fixed other unstable tests by making sure the items are linked. Another common issue making tests unstable is queued state update events of previous tests.