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

Adds an entrypoint for use by JUnit infrastructure #13

Merged
merged 4 commits into from
Jan 20, 2024

Conversation

shartte
Copy link
Contributor

@shartte shartte commented Dec 23, 2023

Depends on McModLauncher/securejarhandler#60

The goal is to add a new entrypoint to BSL for JUnit runners, which disables classloader isolation. This change adds that entrypoint. It is intentionally called testMain to prevent it from being used accidentally via the command-line.

This is used to allow test-classes to live in the GAME layer, while still loading JUnit and other testing library classes found on the normal classpath. When being run by a unit testing framework, we do not control the JVM entrypoint like we normally do, and Gradle for example will class-load JUnit before calling any other hook. Our test classes need to refer to those same loaded classes, making it easier if isolation is disabled in such scenarios.

Copy link
Member

@marchermans marchermans left a comment

Choose a reason for hiding this comment

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

I have thought about this for a while.

Allthough I am convinced that the JUnit API provides other, more standardized, ways of doing testing in a modularly isolated environment, right now we do not have the time.

As such this is at least a bridge and a gap to allow for this to work.

However, since I want to be clear that this should not be used in production, what so ever, I want a very load warning in the source code, in the form of previously mentioned annotations and documentation. As well as, a very loud warning in a log file!

Please add those and then this is good.

Add logging to testing endpoint.
@shartte shartte marked this pull request as ready for review January 13, 2024 18:46
@marchermans marchermans merged commit 61d78d0 into McModLauncher:main Jan 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants