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

Add various lifetime-bound try-with-resources APIs to client gametests #4318

Merged

Conversation

Earthcomputer
Copy link
Contributor

See changes to ClientGameTestTest for an overview of the changes to the API.

context.takeScreenshot("server_config");
server.runCommand("debugconfig unconfig " + profile.getId());
// TODO: better way to wait for reconfiguration to end
context.waitTicks(100);
Copy link
Contributor Author

@Earthcomputer Earthcomputer Dec 21, 2024

Choose a reason for hiding this comment

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

Not having this waitTicks(100) here breaks the assertion in TestServerConnection.close() because reconfiguration sets MinecraftClient.world to null. Ideally I want the close() method to wait for any configuration to finish before trying to disconnect. I tried to fix this for this PR, but I didn't manage to figure out a good way to fix it, so I've left the problem for later. I imagine it's a pretty rare case anyway.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, could you maybe wait until the world has rendered? I dont think it matters a vast amount, as this test is something that I dont expect many if anyone to run. I think I added it after we broke reconfiguration, im not even sure the debugconfig command is registered by default.

Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

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

This is really great, my only slight worry is around agreeing to eula for people.

*
* @param command The command to run
*/
void runCommand(String command);
Copy link
Member

Choose a reason for hiding this comment

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

A thing for the future, but getting the result of the command might be handy, not quite how it would work but I could see it being useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function was just copied over from TestDedicatedServer. But yes, could be handy. Annoyingly the current function it's implemented with doesn't return the result of the command but it should hopefully be a case of finding a different function to use.

context.takeScreenshot("server_config");
server.runCommand("debugconfig unconfig " + profile.getId());
// TODO: better way to wait for reconfiguration to end
context.waitTicks(100);
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, could you maybe wait until the world has rendered? I dont think it matters a vast amount, as this test is something that I dont expect many if anyone to run. I think I added it after we broke reconfiguration, im not even sure the debugconfig command is registered by default.

@modmuss50 modmuss50 added the last call If you care, make yourself heard right away! label Dec 23, 2024
@modmuss50 modmuss50 added the merge me please Pull requests that are ready to merge label Dec 24, 2024
@modmuss50 modmuss50 merged commit 99ff640 into FabricMC:1.21.4 Dec 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
last call If you care, make yourself heard right away! merge me please Pull requests that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants