Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 0 additions & 5 deletions docusaurus/docs/ruby/circleci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ Remove [`KNAPSACK_PRO_FIXED_QUEUE_SPLIT`](reference.md#knapsack_pro_fixed_queue_
command: |
mkdir -p /tmp/test-results

export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true

# highlight-start
export KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=/tmp/tests_to_run.txt
# Retrieve the tests to run (all or just the failed ones), and let Knapsack Pro split them optimally.
Expand All @@ -149,7 +147,6 @@ Remove [`KNAPSACK_PRO_FIXED_QUEUE_SPLIT`](reference.md#knapsack_pro_fixed_queue_
The snippet above:

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

<details>
Expand All @@ -162,8 +159,6 @@ The snippet above:
export CIRCLE_TEST_REPORTS=/tmp/test-results
mkdir -p $CIRCLE_TEST_REPORTS

export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true

# highlight-start
export KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=/tmp/tests_to_run.txt
# Retrieve the tests to run (all or just the failed ones), and let Knapsack Pro split them optimally.
Expand Down
8 changes: 5 additions & 3 deletions docusaurus/docs/ruby/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,11 @@ Parallelize test examples (instead of files) across CI nodes.

:::

```bash
KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
```
Default: `true`

Available:
- `true`: distribute test examples across CI nodes (more balanced builds)
- `false`: distribute whole test files across CI nodes

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

Expand Down
6 changes: 3 additions & 3 deletions docusaurus/docs/ruby/split-by-test-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Only RSpec >= 3.3.0 is supported. [Let us know](https://knapsackpro.com/contact)

:::

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.
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).

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

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

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).

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):
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):

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

:::

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.
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.

:::caution

Expand Down