-
Notifications
You must be signed in to change notification settings - Fork 15
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 docs for Circleci rerun failed tests feature #146
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.
Fantastic that integrates that easily. Great job 🙏
This is a great first step. But what if we actually did it inside the gem, so that users don't have to set up anything?
docusaurus/docs/ruby/circleci.md
Outdated
# highlight-start | ||
# Use circleci CLI to find out if we need to run all tests or rerun failed tests | ||
# We are telling circleci to split the tests across 1 node to get the full list of all tests for consideration. We leave the splitting to Knapsack Pro. | ||
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --index 0 --total 1 --command ">/tmp/tests_to_run.txt xargs echo" --verbose > /tmp/tests_to_run.txt |
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 think that with -n1
you won't need the sed
later:
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --index 0 --total 1 --command ">/tmp/tests_to_run.txt xargs echo" --verbose > /tmp/tests_to_run.txt | |
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --index 0 --total 1 --command ">/tmp/tests_to_run.txt xargs -n1 echo" --verbose > /tmp/tests_to_run.txt |
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.
It works. Cool. 🚀
docusaurus/docs/ruby/circleci.md
Outdated
sed -i 's/ /\n/g' /tmp/tests_to_run.txt | ||
|
||
# tell Knapsack Pro to run only tests from the file (and still use Knapsack Pro Queue Mode magic) | ||
if [[ -s "/tmp/tests_to_run.txt" ]]; then |
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.
This is checking if the file exists and is non-empty. Should that be always the case?
What if we remove the if and let Knapsack Pro raise an error?
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.
good point.
docusaurus/docs/ruby/circleci.md
Outdated
- We use [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`](reference.md#knapsack_pro_test_file_list_source_file) to feed Knapsack Pro with a list of test files to run. | ||
- Optionally, you can use [`KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES`](split-by-test-examples.md) to split slow test files by test examples automatically. |
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'd either mention both in the snippet, or here. Currently, KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES
is present in both.
If the links in the snippet cannot be made clickable, I'd leave them both down here.
- We use [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`](reference.md#knapsack_pro_test_file_list_source_file) to feed Knapsack Pro with a list of test files to run. | |
- Optionally, you can use [`KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES`](split-by-test-examples.md) to split slow test files by test examples automatically. | |
The snippet above uses: | |
- [`KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES`] to split tests by examples | |
- [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`] to specify what tests to run |
Co-authored-by: Riccardo <riccardo.odone@gmail.com>
Co-authored-by: Riccardo <riccardo.odone@gmail.com>
Co-authored-by: Riccardo <riccardo.odone@gmail.com>
Co-authored-by: Riccardo <riccardo.odone@gmail.com>
Co-authored-by: Riccardo <riccardo.odone@gmail.com>
Co-authored-by: Riccardo <riccardo.odone@gmail.com>
…docs.knapsackpro.com into circleci-rerun-failed-tests
story
https://trello.com/c/XFXyRYPu