You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/src/changelog.md
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,16 @@ toc_depth: 1
8
8
This page documents new features and bugfixes for cargo-nextest. Please see the [stability
9
9
policy](https://nexte.st/docs/stability/) for how versioning works with cargo-nextest.
10
10
11
+
## [0.9.90] - 2025-02-12
12
+
13
+
### Added
14
+
15
+
- Tests are now assigned global and group *slot numbers*. These numbers are non-negative integers starting from 0 that are unique for the lifetime of the test, but are reused after the test ends.
16
+
17
+
Global and group slot numbers can be accessed via the `NEXTEST_TEST_GLOBAL_SLOT` and `NEXTEST_TEST_GROUP_SLOT` environment variables, respectively. For more, see [*Slot numbers*](http://nexte.st/docs/configuration/test-groups#slot-numbers).
18
+
19
+
-[Test environments](http://nexte.st/docs/configuration/env-vars/#environment-variables-nextest-sets) now have the `NEXTEST_TEST_GROUP` variable set to the [test group](http://nexte.st/docs/configuration/test-groups) they're in, or `"@global"` if the test is not in any groups.
20
+
11
21
## [0.9.89] - 2025-02-10
12
22
13
23
### Added
@@ -1369,6 +1379,7 @@ Supported in this initial release:
1369
1379
- [Test retries](https://nexte.st/book/retries.md) and flaky test detection
1370
1380
- [JUnit support](https://nexte.st/book/junit.md) for integration with other test tooling
Copy file name to clipboardExpand all lines: site/src/docs/configuration/env-vars.md
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,17 @@ Nextest exposes these environment variables to your tests _at runtime only_. The
82
82
`NEXTEST_EXECUTION_MODE`
83
83
: Currently, always set to `process-per-test`. More options may be added in the future if nextest gains the ability to run all tests within the same process ([#27]).
84
84
85
+
`NEXTEST_TEST_GROUP`<!-- md:version 0.9.90 -->
86
+
: Set to the [test group](test-groups.md) the test is in, or `"@global"` if the test is not in any groups.
: Set to the [global slot number](test-groups.md#slot-numbers). Global slot numbers are non-negative integers starting from 0 that are unique within the run for the lifetime of the test, but are reused after the test finishes.
: If the test is in a group, set to the [group slot number](test-groups.md#slot-numbers). Group slot numbers are non-negative integers that are unique within the test group for the lifetime of the test, but are reused after the test finishes.
93
+
94
+
If the test is not in any groups, this is set to `"none"`.
95
+
85
96
`NEXTEST_BIN_EXE_<name>`
86
97
: The absolute path to a binary target's executable. This is only set when running an [integration test] or benchmark. The `<name>` is the name of the binary target, exactly as-is. For example, `NEXTEST_BIN_EXE_my-program` for a binary named `my-program`.
Copy file name to clipboardExpand all lines: site/src/docs/configuration/test-groups.md
+32-3Lines changed: 32 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,8 @@ These test groups impact execution in the following ways:
72
72
73
73
Nextest will continue to schedule as many tests as possible, accounting for global and group concurrency limits.
74
74
75
+
<!-- md:version 0.9.90 --> The test group a test is running in is exposed via the `NEXTEST_TEST_GROUP` environment variable. If a test is not in any groups, this variable is set to `"@global"`.
76
+
75
77
## Showing test groups
76
78
77
79
You can show the test groups currently in effect with `cargo nextest show-config test-groups`.
@@ -94,6 +96,33 @@ group: <u style="text-decoration-style:single"><b>serial-integration</b></u> (ma
94
96
95
97
This command accepts [all the same options](../listing.md#options-and-arguments) that `cargo nextest list` does.
96
98
99
+
## Slot numbers
100
+
101
+
<!-- md:version 0.9.90 -->
102
+
103
+
Nextest assigns each test a *global slot number*. Additionally, if a test is in a group, the test is also assigned a *group slot number*.
104
+
105
+
Slot numbers are integers that start from 0 and go up from there. They are useful to assign resources such as blocks of port numbers to tests.
106
+
107
+
Slot numbers are:
108
+
109
+
***Unique** for the lifetime of the test, either globally or within the group.
110
+
111
+
For example, if a test in the group `resource-limited` is assigned the global slot 10 and the group slot 5, then while this test is running:
112
+
113
+
- No other test within the same run will be assigned the global slot 10.
114
+
- No other tests in the `resource-limited` group will be assigned the group slot 5.
115
+
116
+
After this test finishes, the global slot number 10 and the group slot number 5 are freed up, and can be reused for other tests.
117
+
118
+
***Stable** across [retries](../features/retries.md) within the same run (though not across runs).
119
+
120
+
***Compact**, in the sense that each test is always assigned the smallest possible slot number starting from 0, depending on which numbers are free at the time the test starts.
121
+
122
+
For example, if a test group is limited to serial execution, the group slot number is always 0 for those tests.
123
+
124
+
Global and group slot numbers can be accessed via the `NEXTEST_TEST_GLOBAL_SLOT` and `NEXTEST_TEST_GROUP_SLOT`[environment variables](env-vars.md#environment-variables-nextest-sets), respectively. (If a test is not within a group, `NEXTEST_TEST_GROUP_SLOT` is set to `none`.)
125
+
97
126
## Comparison with `threads-required`
98
127
99
128
Test groups are similar to [heavy tests and `threads-required`](threads-required.md). The key difference is that test groups are meant to limit concurrency for subsets of tests, while `threads-required` sets global limits across the entire test run.
@@ -118,7 +147,7 @@ threads-required = 1 # this is the default, shown for clarity
118
147
With this configuration:
119
148
120
149
- Tests whose names start with `group::heavy::`, and tests that start with `group::light::`, are both part of `my-group`.
121
-
- The `group::heavy::` tests will take up two slots within _both_ global and group concurrency limits.
122
-
- The `group::light::` tests will take up one slot within both limits.
150
+
- The `group::heavy::` tests will take up two threads within _both_ global and group concurrency limits.
151
+
- The `group::light::` tests will take up one thread within both limits.
123
152
124
-
> **Note:** Setting `threads-required` to be greater than a test group's `max-threads` will not cause issues; a test that does so will take up all slots available.
153
+
> **Note:** Setting `threads-required` to be greater than a test group's `max-threads` will not cause issues; a test that does so will take up all threads available.
Copy file name to clipboardExpand all lines: site/src/docs/configuration/threads-required.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ icon: material/weight-lifter
6
6
7
7
Nextest achieves [its performance](../benchmarks/index.md) through running [many tests in parallel](../design/how-it-works.md). However, some projects have tests that consume a disproportionate amount of resources like CPU or memory. If too many of these _heavy tests_ are run concurrently, your machine's CPU might be overwhelmed, or it might run out of memory.
8
8
9
-
With nextest, you can mark heavy tests as taking up multiple threads or "slots" out of the total amount of available parallelism. In other words, you can assign those tests a higher "weight". This is done by using the `threads-required`[per-test override](per-test-overrides.md).
9
+
With nextest, you can mark heavy tests as taking up multiple threads out of the total amount of available parallelism. In other words, you can assign those tests a higher "weight". This is done by using the `threads-required`[per-test override](per-test-overrides.md).
10
10
11
11
For example, on a machine with 16 logical CPUs, nextest will run 16 tests concurrently by default. However, if you mark tests that begin with `tests::heavy::` as requiring 2 threads each:
* a positive integer (e.g. `8`) to run that many tests simultaneously.
230
230
* a negative integer (e.g. `-2`) to run available parallelism minus that many tests simultaneously. For example, on a machine with 8 CPU hyperthreads, `-2` would run 6 tests simultaneously.
231
231
232
-
Tests can be marked as taking up more than one available slot. For more, see [*Heavy tests and `threads-required`*](configuration/threads-required.md).
232
+
Tests can be marked as taking up more than one available thread. For more, see [*Heavy tests and `threads-required`*](configuration/threads-required.md).
233
233
234
234
`--run-ignored=only`<!-- md:version 0.9.76 -->
235
235
: Run only ignored tests. (With prior nextest versions, use `--run-ignored=ignored-only`.)
0 commit comments