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

Provide mechanism for managing resources across engines and executions #4252

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
5bfe6ad
Generate ResourceContext for store resources
YongGoose Dec 22, 2024
7992634
Add getStore method in LauncherSession
YongGoose Dec 22, 2024
f3adab1
Add Namespace by reusing Jupiter's Namespace class
YongGoose Jan 6, 2025
e4e60ba
Merge branch 'junit-team:main' into feature/2816
YongGoose Jan 18, 2025
234f7ff
Apply comment
YongGoose Jan 18, 2025
ffde19c
Adding a request-level store to Launcher
YongGoose Jan 19, 2025
4fa576f
Remove logging to SYS_ERR in test
sbrannen Jan 19, 2025
57e20cd
Revise Javadoc and release notes regarding void lookups
sbrannen Jan 19, 2025
30cbe62
Move Kotlin contracts release note to correct section
sbrannen Jan 19, 2025
254ca62
Revise recent changes to @⁠ResourceLock and related APIs
sbrannen Jan 19, 2025
2e14b3d
Revise release notes for 5.12 M1
sbrannen Jan 19, 2025
d583ab0
Fix Javadoc errors
sbrannen Jan 19, 2025
f6eff60
Polish Javadoc in TestTemplateInvocationContextProvider
sbrannen Jan 20, 2025
dde72a9
Polishing
sbrannen Jan 20, 2025
5fd9e88
Remove Void wrapper registration in ReflectionUtils
sbrannen Jan 20, 2025
3f40a7e
Update @⁠since/@⁠API versions in Reflection[Support|Utils] plus polis…
sbrannen Jan 20, 2025
9bddac8
Update Javadoc due to changes in 5fd9e88d07
sbrannen Jan 20, 2025
0fe36c7
Increase test coverage for ReflectionUtils.tryToLoadClass()
sbrannen Jan 20, 2025
2bae68b
Delete cases covered by `Class.forName()`
sormuras Jan 17, 2025
5ca0ced
Fix grammar in Javadoc for NestedMethodSelector
sbrannen Jan 21, 2025
aec4ad9
Update plugin commonCustomUserData to v2.1
renovate[bot] Jan 22, 2025
ba3a4ff
Update actions/stale digest to 5bef64f (#4253)
renovate[bot] Jan 22, 2025
10eeeda
Update github/codeql-action digest to d68b2d4 (#4255)
renovate[bot] Jan 22, 2025
ab41b23
Update codecov/codecov-action digest to 5a605bd (#4257)
renovate[bot] Jan 22, 2025
15539b0
Update graalvm/setup-graalvm digest to aafbedb (#4254)
renovate[bot] Jan 23, 2025
5cb4571
Update actions/attest-build-provenance action to v2.2.0 (#4258)
renovate[bot] Jan 23, 2025
21bb094
Update github/codeql-action digest to dd196fa (#4260)
renovate[bot] Jan 23, 2025
544c3b2
Update plugin plantuml to v8.12
renovate[bot] Jan 23, 2025
3583e01
Use separate local Maven repos when file system type is NTFS (#4259)
marcphilipp Jan 23, 2025
292f6a0
Revert "Use Gradle's new daemon JVM criteria feature"
marcphilipp Jan 23, 2025
9d45d42
Update plugin versions to v0.52.0 (#4262)
renovate[bot] Jan 23, 2025
e78ca1d
Update plugin develocity to v3.19.1
renovate[bot] Jan 23, 2025
73d7f12
Update github/codeql-action digest to ee117c9
renovate[bot] Jan 23, 2025
bf08ea2
Update codecov/codecov-action digest to 0da7aa6
renovate[bot] Jan 24, 2025
6d260da
Remove Twitter/X
marcphilipp Jan 24, 2025
a1a5353
Update codecov/codecov-action digest to 13ce06b
renovate[bot] Jan 26, 2025
9149fb8
Update github/codeql-action digest to f6091c0
renovate[bot] Jan 26, 2025
4c382d0
Update dependency gradle to v8.12.1
renovate[bot] Jan 26, 2025
80a22b6
Update dependency org.apache.groovy:groovy to v4.0.25 (#4273)
renovate[bot] Jan 26, 2025
7b4b972
Revert to older Eclipse version to fix Spotless issue on CI
marcphilipp Jan 26, 2025
ca7bb80
Revert "Revert to older Eclipse version to fix Spotless issue on CI"
marcphilipp Jan 26, 2025
060f4db
Pass enclosing instance types to `DisplayNameGenerators` (#4266)
marcphilipp Jan 26, 2025
511ab7d
Provide runtime enclosing instance types to `ResourceLocksProviders`
marcphilipp Jan 26, 2025
b7349b4
Update dependency com.puppycrawl.tools:checkstyle to v10.21.2 (#4274)
renovate[bot] Jan 27, 2025
7d66196
Re-open completed non-task/-question issues without assigned milestone
marcphilipp Jan 27, 2025
e6446ff
Remove milestone assignment from issues closed as "not planned"
marcphilipp Jan 27, 2025
f93b1fc
Support `@TempDir` constructor injection for Java record classes (#4279)
marcphilipp Jan 27, 2025
54f1996
Apply comment
YongGoose Jan 27, 2025
3fa27e9
Add "Getting Started" section (#4280)
marcphilipp Jan 27, 2025
516a801
Generate ResourceContext for store resources
YongGoose Dec 22, 2024
339c956
Add getStore method in LauncherSession
YongGoose Dec 22, 2024
f92d60f
Add Namespace by reusing Jupiter's Namespace class
YongGoose Jan 6, 2025
96d86c2
Apply comment
YongGoose Jan 18, 2025
82c14be
Adding a request-level store to Launcher
YongGoose Jan 19, 2025
4de6db8
Apply comment
YongGoose Jan 27, 2025
7fdeb72
Merge remote-tracking branch 'origin/feature/2816' into feature/2816
YongGoose Jan 27, 2025
628f8cb
Revert "Apply comment"
YongGoose Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/close-inactive-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
with:
only-labels: "status: waiting-for-feedback"
days-before-stale: 14
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Initialize CodeQL
uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3
uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3
with:
languages: ${{ matrix.language }}
tools: linked
Expand All @@ -47,4 +47,4 @@ jobs:
-Dscan.tag.CodeQL \
allMainClasses
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3
uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
fetch-depth: 1
- name: Install GraalVM
uses: graalvm/setup-graalvm@c09e29bb115a83bd4b7c7e99bb46e2e8a1c50466 # v1
uses: graalvm/setup-graalvm@aafbedb8d382ed0ca6167d3a051415f20c859274 # v1
with:
distribution: graalvm-community
version: 'latest'
Expand All @@ -39,7 +39,7 @@ jobs:
jacocoRootReport \
--no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318
- name: Upload to Codecov.io
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
publish -x check \
prepareGitHubAttestation
- name: Generate build provenance attestations
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0
with:
subject-path: documentation/build/attestation/*.jar

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ossf-scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3
uses: github/codeql-action/upload-sarif@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
:verifyArtifactsInStagingRepositoryAreReproducible \
--remote-repo-url=${{ env.STAGING_REPO_URL }}
- name: Generate build provenance attestations
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0
with:
subject-path: build/repo/**/*.jar
- name: Upload local repository for later jobs
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/sanitize-closed-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Sanitizes assigned labels and milestone on closed issues
on:
issues:
types:
- closed
permissions: read-all
jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const issue = await github.rest.issues.get({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const originalLabels = issue.data.labels.map(l => l.name);
const newLabels = originalLabels.filter(l => l !== "status: in progress" && l !== "status: new");
if (newLabels.length !== originalLabels.length) {
await github.rest.issues.update({
issue_number: issue.data.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: newLabels,
});
}
if (issue.data.state_reason === "not_planned") {
if (issue.data.milestone) {
await github.rest.issues.update({
issue_number: issue.data.number,
owner: context.repo.owner,
repo: context.repo.repo,
milestone: null,
});
}
const statusLabels = newLabels.filter(l => l.startsWith("status: "));
if (statusLabels.length === 0) {
await github.rest.issues.createComment({
issue_number: issue.data.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Please assign a status label to this issue.",
});
await github.rest.issues.update({
issue_number: issue.data.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
});
}
} else {
if (!(newLabels.includes("type: task") || newLabels.includes("type: question")) && !issue.data.milestone) {
await github.rest.issues.createComment({
issue_number: issue.data.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Please assign a milestone to this issue or label it with `type: task` or `type: question`.",
});
await github.rest.issues.update({
issue_number: issue.data.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
});
}
}
45 changes: 0 additions & 45 deletions .github/workflows/unlabel-closed-issues.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Contributing

## Getting Started

We welcome new contributors to the project!
If you're interested, please check for [issues labeled with `up-for-grabs`
that are not yet in progress](https://github.com/junit-team/junit5/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20label%3Aup-for-grabs%20-label%3A%22status%3A%20in%20progress%22).
Generally, before you work on an issue, post a comment and ask whether it can be started.
Please wait for the core team to respond and assign the issue to you before making any code
changes.

## JUnit Contributor License Agreement

- You will only Submit Contributions where You have authored 100% of the content.
Expand Down
1 change: 0 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
- [ ] Post about the new release:
- [ ] [Mastodon](https://fosstodon.org/@junit)
- [ ] [Bluesky](https://bsky.app/profile/junit.org)
- [ ] [Twitter/X](https://x.com/junitteam)

### Preview releases (milestones and release candidates)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,26 @@ JUnit repository on GitHub.
[[release-notes-5.12.0-M1-junit-platform-new-features-and-improvements]]
==== New Features and Improvements

* New `addResourceContainerSelectorResolver()` in `EngineDiscoveryRequestResolver.Builder` to
support the discovery of class path resource based tests, analogous to the
`addClassContainerSelectorResolver()`.
* Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than
calling the internal `ReflectionUtils.makeAccessible(Field)` method directly.
* Support both the primitive type `void` and the wrapper type `Void` in the internal
`ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests.
* New `--exclude-methodname` and `--include-methodname` options added to the
`ConsoleLauncher` to include or exclude methods based on fully qualified method names
without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname`
will exclude all methods called `methodName` under package `org.example`.
* Add support for passing line and column number to `ConsoleLauncher` via
`--select-file` and `--select-resource`.
* `ConsoleLauncher` now accepts multiple values for all `--select` options.
* Add `--select-unique-id` support to ConsoleLauncher.
* Add `getOutputDirectoryProvider()` method to `EngineDiscoveryRequest` and `TestPlan` to
* `ConsoleLauncher` now supports a `--select-unique-id` option to select containers and
tests by unique ID.
* `ConsoleLauncher` supports new `--exclude-methodname` and `--include-methodname` options
to include or exclude methods based on fully qualified method names without parameters.
For example, `--exclude-methodname=^org\.example\..+#methodname` will exclude all
methods called `methodName` under package `org.example`.
* The `--select-file` and `--select-resource` options for the `ConsoleLauncher` now
support line and column numbers.
* New `ReflectionSupport.makeAccessible(Field)` public utility method to be used by third
parties instead of calling the internal `ReflectionUtils.makeAccessible(Field)` method
directly.
* The `ReflectionSupport.tryToLoadClass(...)` utility methods now support lookups for the
`"void"` pseudo-type, which indirectly supports `String` to `Class` conversion for
`"void"` in parameterized tests in JUnit Jupiter.
* New `addResourceContainerSelectorResolver()` method in
`EngineDiscoveryRequestResolver.Builder` which supports the discovery of class path
resource based tests, analogous to the existing `addClassContainerSelectorResolver()`
method.
* New `getOutputDirectoryProvider()` method in `EngineDiscoveryRequest` and `TestPlan` to
allow test engines to publish/attach files to containers and tests by calling
`EngineExecutionListener.fileEntryPublished(...)`. Registered `TestExecutionListeners`
can then access these files by overriding the `fileEntryPublished(...)` method.
Expand All @@ -69,7 +73,6 @@ JUnit repository on GitHub.
in the XML report.
* Output written to `System.out` and `System.err` from non-test threads is now attributed
to the most recent test or container that was started or has written output.
* Introduced contracts for Kotlin-specific assertion methods.
* New public interface `ClasspathScanner` allowing third parties to provide a custom
implementation for scanning the classpath for classes and resources.

Expand All @@ -80,65 +83,69 @@ JUnit repository on GitHub.
[[release-notes-5.12.0-M1-junit-jupiter-bug-fixes]]
==== Bug Fixes

* ❓
* Provide _runtime_ enclosing types of `@Nested` test classes and contained test methods
to `DisplayNameGenerator` implementations. Prior to this change, such generators were
only able to access the enclosing class in which `@Nested` was declared, but they could
not access the concrete runtime type of the enclosing instance.

[[release-notes-5.12.0-M1-junit-jupiter-deprecations-and-breaking-changes]]
==== Deprecations and Breaking Changes

* When injecting `TestInfo` into test class constructors it now contains data of the test
method the test class instance is being created for unless the test instance lifecycle
is set to `PER_CLASS` (in which case it continues to contain the data of the test
class). If you require the `TestInfo` of the test class, you can implement a class-level
lifecycle method (e.g., `@BeforeAll`) and inject `TestInfo` into that method.
* When injecting `TestInfo` into test class constructors, the `TestInfo` now contains data
for the test method for which the test class instance is being created, unless the test
instance lifecycle is set to `PER_CLASS` (in which case it continues to contain the data
for the test class). If you require the `TestInfo` of the test class, you can implement
a `@BeforeAll` lifecycle method and inject `TestInfo` into that method.
* When injecting `TestReporter` into test class constructors the published report entries
are now associated with the test method rather than the test class unless the test
instance lifecycle is set to `PER_CLASS` (in which case they will continue to be
associated with the test class). If you want to publish report entries for the test
class, you can implement a class-level lifecycle method (e.g., `@BeforeAll`) and inject
are now associated with the test method rather than the test class, unless the test
instance lifecycle is set to `PER_CLASS` (in which case the published report entries
will continue to be associated with the test class). If you want to publish report
entries for the test class, you can implement a `@BeforeAll` lifecycle method and inject
`TestReporter` into that method.

[[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]]
==== New Features and Improvements

* Kotlin contracts for Kotlin-specific assertion methods in `Assertions`.
* `@TempDir` is now supported on test class constructors.
* Shared resource locks may now be determined programmatically at runtime via the new
`@ResourceLock#providers` attribute that accepts implementations of
`ResourceLocksProvider`.
* Shared resource locks for _direct_ child nodes may now be configured via the new
`@ResourceLock(target = CHILDREN)` attribute. This may improve parallelization when
a test class declares a `READ` lock, but only a few methods hold a `READ_WRITE` lock.
* `@EnumSource` has new `from` and `to` attributes that support the selection of enum
constants within the specified range.
* In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time
types such as `LocalDate` if the new `nullable` attribute in
`@JavaTimeConversionPattern` is set to `true`.
* The new `@ParameterizedTest(allowZeroInvocations = true)` attribute allows to specify that
the absence of invocations is expected in some cases and should not cause a test failure.
* Parameterized tests now support argument count validation. If the
`junit.jupiter.params.argumentCountValidation=strict` configuration parameter or the
`@ParameterizedTest(argumentCountValidation = STRICT)` attribute is set, any mismatch
between the declared number of arguments and the number of arguments provided by the
arguments source will result in an error. By default, it is still only an error if there
are fewer arguments provided than declared.
* `ArgumentsProvider` (declared via `@ArgumentsSource`), `ArgumentConverter` (declared via
`@ConvertWith`), and `ArgumentsAggregator` (declared via `@AggregateWith`)
implementations can now use constructor injection from registered `ParameterResolver`
extensions.
* Extensions based on `TestTemplateInvocationContextProvider` can now allow returning zero
invocation contexts by overriding the new `mayReturnZeroTestTemplateInvocationContexts`
method.
* The new `@ParameterizedTest(allowZeroInvocations = true)` attribute allows to specify that
the absence of invocations is expected in some cases and should not cause a test failure.
* Allow determining "shared resources" at runtime via the new `@ResourceLock#providers`
attribute that accepts implementations of `ResourceLocksProvider`.
* Allow declaring "shared resources" for _direct_ child nodes via the new
`@ResourceLock(target = CHILDREN)` attribute. This may improve parallelization when
a test class declares a `READ` lock, but only a few methods hold a `READ_WRITE` lock.
* `TestTemplateInvocationContextProvider` extensions can now signal that they may
potentially return zero invocation contexts by overriding the new
`mayReturnZeroTestTemplateInvocationContexts()` method.
* Extensions that implement `TestInstancePreConstructCallback`, `TestInstanceFactory`,
`TestInstancePostProcessor`, `ParameterResolver`, or `InvocationInterceptor` may
override the `getTestInstantiationExtensionContextScope()` method to enable receiving
a test-scoped `ExtensionContext` in `Extension` methods called during test class
instantiation. This behavior will become the default in future versions of JUnit.
* `@TempDir` is now supported on test class constructors.
* Parameterized tests now support argument count validation.
If the `junit.jupiter.params.argumentCountValidation=strict` configuration parameter
or the `@ParameterizedTest(argumentCountValidation = STRICT)` attribute is set, any
mismatch between the declared number of arguments and the number of arguments provided
by the arguments source will result in an error. By default, it's still only an error if
there are fewer arguments provided than declared.
* The new `PreInterruptCallback` extension point defines the API for `Extensions` that
wish to be called prior to invocations of `Thread#interrupt()` by the `@Timeout`
extension.
* The new `PreInterruptCallback` interface defines the API for `Extensions` that wish to
be called prior to invocations of `Thread#interrupt()` by the `@Timeout` extension.
* When enabled via the `junit.jupiter.execution.timeout.threaddump.enabled` configuration
parameter, an implementation of `PreInterruptCallback` is registered that writes a
thread dump to `System.out` prior to interrupting a test thread due to a timeout.
* `TestReporter` now allows publishing files for a test method or test class which can be
used to include them in test reports, such as the Open Test Reporting format.
* New `from` and `to` attributes added to `@EnumSource` to support range selection of
enum constants.
* Auto-registered extensions can now be
<<../user-guide/index.adoc#extensions-registration-automatic-filtering, filtered>> using
include and exclude patterns that can be specified as configuration parameters.
Expand All @@ -160,6 +167,6 @@ JUnit repository on GitHub.
[[release-notes-5.12.0-M1-junit-vintage-new-features-and-improvements]]
==== New Features and Improvements

* Introduced support for executing top-level test classes in parallel. Please refer to the
* Support for executing top-level test classes in parallel. Please refer to the
<<../user-guide/index.adoc#migrating-from-junit4-parallel-execution, User Guide>> for
more information.
Loading
Loading