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

test: add info logs to help track down sporadic #5040

Merged
merged 5 commits into from
Jun 4, 2022

Conversation

jdrueckert
Copy link
Member

@jdrueckert jdrueckert commented Jun 4, 2022

We saw a sporadic test failure on develop builds recently (e.g., develop/709 a0c6606).

org.opentest4j.MultipleFailuresError: Multiple Failures (1 failure)
    org.opentest4j.AssertionFailedError: expected: <org.terasology.engine.core.modes.StateIngame> but was: <org.terasology.engine.core.modes.StateLoading>

To help understand which of the "engines" is actually in the wrong state, we add some logging information about the instances.

This should help to figure out whether the createClient() method is errorneous (as it should be blocking until the client is in state in-game) or the failure lies with the host's engine.

Furthermore, this PR changes Engines::connectToHost to return whether waiting for the engine to enter StateIngame succeeded or timed out. This allows to fail early and intentionally if the engine did not make it into the expected state.

@jdrueckert jdrueckert added Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Size: S Small effort likely only affecting a single area and requiring little to no research Type: Chore Request for or implementation of maintenance changes labels Jun 4, 2022
skaldarnar
skaldarnar previously approved these changes Jun 4, 2022
skaldarnar
skaldarnar previously approved these changes Jun 4, 2022
Comment on lines +139 to +141
if (!connectToHost(client, mainLoop)) {
throw new RuntimeException(String.format("Could not connect client %s to local host - timeout.", client));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part uses the information whether the connection was successful or not. The runtime exception will hopefully show up nicely in the test results to give us a hint that this precondition did not hold.

terasologyEngine.getFromEngineContext(SystemConfig.class).writeSaveGamesEnabled.set(false);
terasologyEngine.subscribeToStateChange(new HeadlessStateChangeListener(terasologyEngine));
terasologyEngine.changeState(new TestingStateHeadlessSetup(dependencies, worldGeneratorUri));
TerasologyEngine host = createHeadlessEngine();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a rename to make it less confusing which "engine" is a client and which is a host.

@jdrueckert jdrueckert merged commit f4d3d5d into develop Jun 4, 2022
@jdrueckert jdrueckert deleted the test/add-info-output branch June 4, 2022 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Size: S Small effort likely only affecting a single area and requiring little to no research Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Chore Request for or implementation of maintenance changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants