Skip to content

Commit

Permalink
Merge branch 'master' into refactor-queue-rspec-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturT authored Feb 2, 2024
2 parents f5b6a2b + 63ecba8 commit 009204c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 80 deletions.
79 changes: 0 additions & 79 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,10 @@ jobs:
- run:
name: Database setup for parallel_tests gem
command: TEST_ENV_NUMBER=2 bin/rails db:setup
- run:
command: |
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=$KNAPSACK_PRO_QUEUE_TEST_SUITE_TOKEN_RSPEC
bundle exec rake knapsack_pro:queue:rspec

# Queue Mode: retry CI with the same test suite split as the last dynamic queue run.
# (Test --profile formatter to show only once the profile summary.)
- run:
command: |
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=$KNAPSACK_PRO_QUEUE_TEST_SUITE_TOKEN_RSPEC
bundle exec rake "knapsack_pro:queue:rspec[--profile]"
Expand Down Expand Up @@ -112,19 +106,6 @@ jobs:
echo "Report files not found. Nothing to import to Calliope.pro"
fi
# Queue Mode: retry CI with the same test suite split as the last dynamic queue run.
- run:
command: |
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=$KNAPSACK_PRO_QUEUE_TEST_SUITE_TOKEN_RSPEC
bundle exec rake knapsack_pro:queue:rspec
# Queue Mode: connect to a queue of tests that was already all consumed (no tests will run).
- run:
command: |
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=$KNAPSACK_PRO_QUEUE_TEST_SUITE_TOKEN_RSPEC
bundle exec rake knapsack_pro:queue:rspec
# Queue Mode and parallel_tests gem
- run:
command: |
Expand All @@ -134,36 +115,6 @@ jobs:
export KNAPSACK_PRO_CI_NODE_INDEX=$CIRCLE_NODE_INDEX
bundle exec parallel_test -n $PARALLEL_TESTS_CONCURRENCY -e './bin/parallel_tests'
# Queue Mode: RSpec split by test examples
- run:
name: RSpec split by test cases (Queue Mode)
command: |
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=$KNAPSACK_PRO_QUEUE_TEST_SUITE_TOKEN_RSPEC_SPLIT_BY_TEST_CASES
export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
bundle exec rake knapsack_pro:queue:rspec
- run:
name: RSpec split by test cases (Regular Mode) with KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN
command: |
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=$KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC_SPLIT_BY_TEST_CASES
export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
export KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN="{spec/timecop_spec.rb}"
bundle exec rake knapsack_pro:rspec
# Queue Mode: Minitest
- run:
command: |
export KNAPSACK_PRO_RSPEC_DISABLED=true
export KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST=$KNAPSACK_PRO_QUEUE_TEST_SUITE_TOKEN_MINITEST
bundle exec rake knapsack_pro:queue:minitest[--verbose]
# Regular Mode
- run:
command: |
export KNAPSACK_PRO_FIXED_TEST_SUITE_SPLIT=false
bundle exec rake knapsack_pro:rspec
# Regular Mode with junit formatter
- run:
command: |
Expand Down Expand Up @@ -246,11 +197,6 @@ jobs:
echo "Report files not found. Nothing to import to Calliope.pro"
fi
- run:
command: |
export KNAPSACK_PRO_RSPEC_DISABLED=true
bundle exec rake knapsack_pro:minitest[--verbose]
- run:
command: |
export KNAPSACK_PRO_TEST_DIR=test-unit
Expand All @@ -262,24 +208,6 @@ jobs:
export KNAPSACK_PRO_TEST_FILE_PATTERN="spinach_features/**{,/*/**}/*.feature"
bundle exec rake knapsack_pro:spinach
# Check if https endpoint is working
- run:
command: |
export KNAPSACK_PRO_FIXED_TEST_SUITE_SPLIT=false
export KNAPSACK_PRO_ENDPOINT=https://api-staging.knapsackpro.com
bundle exec rake knapsack_pro:rspec
- run:
command: |
export KNAPSACK_PRO_ENDPOINT=https://api-staging.knapsackpro.com
bundle exec rake knapsack_pro:cucumber
- run:
command: |
export KNAPSACK_PRO_RSPEC_DISABLED=true
export KNAPSACK_PRO_ENDPOINT=https://api-staging.knapsackpro.com
bundle exec rake knapsack_pro:minitest[--verbose]
# Example of encrypted test files names
# KNAPSACK_PRO_SALT is set in CircleCI settings
- run:
Expand All @@ -306,13 +234,6 @@ jobs:
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=$KNAPSACK_PRO_FOR_ENCRYPTED_QUEUE_TEST_SUITE_TOKEN_RSPEC
bundle exec rake knapsack_pro:queue:rspec
# Fallback when cannot connect to API
- run:
command: |
export KNAPSACK_PRO_ENDPOINT=https://api-fake.knapsackpro.com
export KNAPSACK_PRO_MAX_REQUEST_RETRIES=1
bundle exec rake knapsack_pro:rspec
- run:
command: |
export KNAPSACK_PRO_LOG_LEVEL=warn
Expand Down
3 changes: 2 additions & 1 deletion spec/support/config/rspec_retry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
config.verbose_retry = true
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
# --fail-fast option makes RSpec fail after X failed tests. This can lead to canceled test execution in Queue Mode

# --fail-fast option makes RSpec fail after X failed tests. This can lead to canceled tests in Queue Mode.
#config.fail_fast = 1

# run retry only on features
Expand Down
7 changes: 7 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
knapsack_pro_adapter = KnapsackPro::Adapters::MinitestAdapter.bind
knapsack_pro_adapter.set_test_helper_path(__FILE__)

require 'simplecov'
SimpleCov.start

KnapsackPro::Hooks::Queue.before_queue do |queue_id|
SimpleCov.command_name("minitest_ci_node_#{KnapsackPro::Config::Env.ci_node_index}")
end

class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
Expand Down

0 comments on commit 009204c

Please sign in to comment.