Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MqttBrokerConnectionTests unstable #1139

Closed
cweitkamp opened this issue Oct 16, 2019 · 2 comments · Fixed by #1191
Closed

MqttBrokerConnectionTests unstable #1139

cweitkamp opened this issue Oct 16, 2019 · 2 comments · Fixed by #1191
Labels

Comments

@cweitkamp
Copy link
Contributor

See e.g. Travis https://travis-ci.org/openhab/openhab-core/jobs/598834457

[ERROR] timeoutWhenNotReachableFuture(org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests)  Time elapsed: 0.205 s  <<< FAILURE!
org.mockito.exceptions.verification.NeverWantedButInvoked: 
connectionCallback.onFailure(<any>, <any>);
Never wanted here:
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.timeoutWhenNotReachableFuture(MqttBrokerConnectionTests.java:225)
But invoked here:
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnection.lambda$1(MqttBrokerConnection.java:733)
	at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.timeoutWhenNotReachableFuture(MqttBrokerConnectionTests.java:225)
@cweitkamp cweitkamp added bug An unexpected problem or unintended behavior of the Core test labels Oct 16, 2019
@cweitkamp
Copy link
Contributor Author

One more (see Travis https://travis-ci.org/openhab/openhab-core/jobs/600039891).

[ERROR] reconnectPolicy(org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests)  Time elapsed: 0.067 s  <<< FAILURE!
org.mockito.exceptions.verification.WantedButNotInvoked: 

Wanted but not invoked:

mqttBrokerConnectionEx.start();
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.reconnectPolicy(MqttBrokerConnectionTests.java:167)

However, there were exactly 7 interactions with this mock:
mqttBrokerConnectionEx.setConnectionCallback(
    org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionEx$MockitoMock$1253350811@4aa3d36
);
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.reconnectPolicy(MqttBrokerConnectionTests.java:143)

mqttBrokerConnectionEx.setReconnectStrategy(
    org.eclipse.smarthome.io.transport.mqtt.reconnect.PeriodicReconnectStrategy@2d140a7
);
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.reconnectPolicy(MqttBrokerConnectionTests.java:146)

mqttBrokerConnectionEx.getReconnectStrategy();
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.reconnectPolicy(MqttBrokerConnectionTests.java:147)

mqttBrokerConnectionEx.setReconnectStrategy(
    org.eclipse.smarthome.io.transport.mqtt.reconnect.PeriodicReconnectStrategy$MockitoMock$1533906995@2aa27288
);
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.reconnectPolicy(MqttBrokerConnectionTests.java:156)

mqttBrokerConnectionEx.cancelTimeoutFuture();
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnection$ConnectionCallback.onFailure(MqttBrokerConnection.java:148)

mqttBrokerConnectionEx.connectionState();
-> at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnection$ConnectionCallback.onFailure(MqttBrokerConnection.java:152)

mqttBrokerConnectionEx.getHost();
-> at org.eclipse.smarthome.io.transport.mqtt.reconnect.PeriodicReconnectStrategy.lambda$0(PeriodicReconnectStrategy.java:116)

	at org.eclipse.smarthome.io.transport.mqtt.MqttBrokerConnectionTests.reconnectPolicy(MqttBrokerConnectionTests.java:167)

@wborn
Copy link
Member

wborn commented Oct 19, 2019

Hopefully #1125 is merged soon so we can see if it is still an issue and fix it without causing merge conflicts.

wborn added a commit to wborn/openhab-core that referenced this issue Nov 8, 2019
Using waitForAssert instead of sleeping 10ms makes the tests stable when the system has some load.

Fixes openhab#1139

Signed-off-by: Wouter Born <github@maindrain.net>
kaikreuzer pushed a commit that referenced this issue Nov 8, 2019
Using waitForAssert instead of sleeping 10ms makes the tests stable when the system has some load.

Fixes #1139

Signed-off-by: Wouter Born <github@maindrain.net>
@wborn wborn removed the bug An unexpected problem or unintended behavior of the Core label Dec 30, 2019
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this issue Jul 11, 2023
Using waitForAssert instead of sleeping 10ms makes the tests stable when the system has some load.

Fixes openhab#1139

Signed-off-by: Wouter Born <github@maindrain.net>
GitOrigin-RevId: cd3f337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants