Skip to content

Commit 6e33030

Browse files
committed
chore: enable split by test examples by default
1 parent 6bdd69d commit 6e33030

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

docusaurus/docs/ruby/circleci.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ Remove [`KNAPSACK_PRO_FIXED_QUEUE_SPLIT`](reference.md#knapsack_pro_fixed_queue_
129129
command: |
130130
mkdir -p /tmp/test-results
131131
132-
export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
133-
134132
# highlight-start
135133
export KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=/tmp/tests_to_run.txt
136134
# Retrieve the tests to run (all or just the failed ones), and let Knapsack Pro split them optimally.
@@ -149,7 +147,6 @@ Remove [`KNAPSACK_PRO_FIXED_QUEUE_SPLIT`](reference.md#knapsack_pro_fixed_queue_
149147
The snippet above:
150148

151149
- [Collects metadata with the JUnit XML formatter](#collect-metadata-in-queue-mode)
152-
- uses [`KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES`](split-by-test-examples.mdx) to split slow spec files by test examples
153150
- uses [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`](reference.md#knapsack_pro_test_file_list_source_file) to specify what tests to run
154151

155152
<details>
@@ -162,8 +159,6 @@ The snippet above:
162159
export CIRCLE_TEST_REPORTS=/tmp/test-results
163160
mkdir -p $CIRCLE_TEST_REPORTS
164161
165-
export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
166-
167162
# highlight-start
168163
export KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=/tmp/tests_to_run.txt
169164
# Retrieve the tests to run (all or just the failed ones), and let Knapsack Pro split them optimally.

docusaurus/docs/ruby/reference.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,11 @@ Parallelize test examples (instead of files) across CI nodes.
310310

311311
:::
312312

313-
```bash
314-
KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
315-
```
313+
Default: `true`
314+
315+
Available:
316+
- `true`: distribute test examples across CI nodes (more balanced builds)
317+
- `false`: distribute whole test files across CI nodes
316318

317319
Make sure to read the details in [Split by test examples](split-by-test-examples.mdx).
318320

docusaurus/docs/ruby/split-by-test-examples.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Only RSpec >= 3.3.0 is supported. [Let us know](https://knapsackpro.com/contact)
2525

2626
:::
2727

28-
You can set [`KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES`](reference.md#knapsack_pro_rspec_split_by_test_examples-rspec) to parallelize tests across CI nodes by example (`it`/`specify`). This is useful when you have slow test files but don't want to manually split test examples into smaller test files.
28+
By default, Knapsack Pro parallelizes tests across CI nodes by example (`it`/`specify`). This is useful when you have slow test files but don't want to manually split test examples into smaller test files. You can disable this feature with [`KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=false`](reference.md#knapsack_pro_rspec_split_by_test_examples-rspec).
2929

3030
As an example, imagine you have two test files in your suite:
3131

@@ -56,7 +56,7 @@ As an example, imagine you have two test files in your suite:
5656

5757
On your [Knapsack Pro dashboard](../overview/index.mdx#dashboard), you can see the yellow highlight because of the bottleneck: if you run those tests on 2 parallel CI nodes, the total execution time would be 6.5 minutes instead of the optimal 4.5 minutes (2.5 minutes + 6.5 minutes divided by 2 CI nodes).
5858

59-
By enabling `KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES`, the bottleneck disappears because Knapsack Pro can distribute tests so that each CI node is balanced (e.g., 4.5 minutes + 4.5 minutes):
59+
When splitting by test examples, the bottleneck disappears because Knapsack Pro distributes individual tests so that each CI node is balanced (e.g., 4.5 minutes + 4.5 minutes):
6060

6161
<div style={{ overflowX: 'auto' }}>
6262
<table style={{ width: '100%', display: 'table' }}>
@@ -116,7 +116,7 @@ Does not support `--tag`
116116

117117
:::
118118

119-
Due to the [RSpec internals](https://github.com/rspec/rspec-core/issues/2522), `--tag` might be ignored when used together with `KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES`. But you can use the `KNAPSACK_PRO_TEST_FILE_*` [environment variables](reference.md) to filter the test files to run.
119+
Due to the [RSpec internals](https://github.com/rspec/rspec-core/issues/2522), `--tag` might be ignored when used together with Split by test examples. But you can use the `KNAPSACK_PRO_TEST_FILE_*` [environment variables](reference.md) to filter the test files to run.
120120

121121
:::caution
122122

0 commit comments

Comments
 (0)