-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 timeout config parameter #2026
Add timeout config parameter #2026
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't look into the implementation, yet -- but already found some issues.
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java
Outdated
Show resolved
Hide resolved
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java
Outdated
Show resolved
Hide resolved
...t-jupiter-engine/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java
Outdated
Show resolved
Hide resolved
...t-jupiter-engine/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java
Outdated
Show resolved
Hide resolved
I'm obviously hitting some errors but when I run gradlew test locally I'm seeing everything pass. What should I be running to see these errors? |
junit5/.github/workflows/main.yml Line 24 in da135a4
Without the '--scan' option, if you don't want to. |
Closing for now. Thought I was closer to done but I looks like that was incorrect. |
junit-jupiter-engine/src/module/org.junit.jupiter.engine/module-info.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
junit-jupiter-engine/src/module/org.junit.jupiter.engine/module-info.java
Outdated
Show resolved
Hide resolved
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java
Outdated
Show resolved
Hide resolved
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java
Outdated
Show resolved
Hide resolved
Not really, you can check if the VM is listening to port 5005 but this does not help if the debugging port has changed. As far as I know, there is no good mechanism. |
Thanks for the feedback, @raphw. So checking only for |
@@ -9,7 +9,8 @@ | |||
*/ | |||
|
|||
module org.junit.platform.commons { | |||
requires java.logging; // TODO Is "requires transitive java.logging" needed here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the superseded TODO
on-the-fly -- the module API of org.junit.platform.commons
does not use types of java.logging
.
@@ -9,7 +9,8 @@ | |||
*/ | |||
|
|||
module org.junit.platform.commons { | |||
requires java.logging; // TODO Is "requires transitive java.logging" needed here? | |||
requires java.logging; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left the static
modifier out on purpose -- because we need the module when running on the module path.
Otherwise, users have to add it via --add-module java.management
or via their module descriptor(s).
With ce1892c I enforced
That |
Ah I like it. Ok I'll take a peek and try and get those final missing pieces finished soon. |
Huh I'm stumped on the JMX environment test. I tried my tests that I had created earlier and there was never a failure. I then commented out the java.management module change made by @sormuras in the platform module-info file
Also removed it from junit-platform-commons.expected to make sure a build should pass. I cleaned and then rebuilt and no errors occurred during the build. I rechecked out this branch fresh and again removed the java.management line above and re-tested a clean build a third time and again there was no errors thrown. I don't see how this is possible. Anyways I'll check in the new unit test for the |
...t-jupiter-engine/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java
Show resolved
Hide resolved
I'll add it later this week to this branch ... or after merging it. Or #2054 will provide such an integration test as a side effect. |
* </ul> | ||
* | ||
* @since 5.6 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Javadoc should document the default value.
@@ -38,6 +42,9 @@ | |||
private static final ExtensionContext.Namespace NAMESPACE = ExtensionContext.Namespace.create(Timeout.class); | |||
private static final String TESTABLE_METHOD_TIMEOUT_KEY = "testable_method_timeout_from_annotation"; | |||
private static final String GLOBAL_TIMEOUT_CONFIG_KEY = "global_timeout_config"; | |||
public static final String ENABLED_MODE_VALUE = "enabled"; | |||
public static final String DISABLED_MODE_VALUE = "disabled"; | |||
public static final String DISABLED_ON_DEBUG_MODE_VALUE = "disabled_on_debug"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be private
.
Thanks @chrischild |
My pleasure. I wish I could've figured out the environment test though. I went back again and tried to see what else I might have missed but couldn't find a solution. I'll be keeping an eye on the Android integration test so I can see how it gets solved. |
Overview
Added a new configuration parameter (junit.jupiter.execution.timeout.mode) to determine if timeouts should be applied to annotated tests.
Couple of notes/questions:
Since the default was to have it be enabled but still allow someone to comment the parameter out I wondered whether there was any reason to see if the value was set to "enabled" or not. To me there's no reason so I only checked to see if the value was "disabled" or "disabled_on_debug". Thoughts?
Testing: I created one new test to make sure that setting the value to "disabled" truly did disable the timeouts. If there's a way to test the "disabled_on_debug" let me know.
Resolves #1959.
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations