Skip to content

All examples skipped after exception in before: suite hook in queue mode #196

@amanfredi

Description

@amanfredi

We run 40 parallel CI runners using knapsack pro queue mode, which normally complete in about 10 minutes each.
I recently observed that after retrying certain failed test nodes, the test runner would consistently time out. I realized this was because the runner had fetched more tests from the knapsack queue than it could possibly execute, and that distribution was persisted with the fixed queue split & retry configuration. The underlying cause of this is that the first failure did not fail the entire run, but instead caused knapsack to continue fetching examples from the queue and then not actually execute them.

See the following log for examples:

I, [2023-05-19T16:35:06.300147 #129]  INFO -- : [knapsack_pro] To retry the last batch of tests fetched from the API Queue, please run the following command on your machine:
I, [2023-05-19T16:35:06.300239 #129]  INFO -- : [knapsack_pro] bundle exec rspec --profile=5 --format documentation --color --format RspecJunitFormatter --out tmp/rspec.xml --default-path spec <<<spec-files-batch-1>>>"

An error occurred in a `before(:suite)` hook.
Failure/Error: DatabaseCleaner.clean

ActiveRecord::ConnectionTimeoutError:
  could not obtain a connection from the pool within 5.000 seconds (waited 5.005 seconds); all pooled connections were in use
<<<stacktrace>>>

I, [2023-05-19T16:35:11.656783 #129]  INFO -- : [knapsack_pro] To retry the last batch of tests fetched from the API Queue, please run the following command on your machine:
I, [2023-05-19T16:35:11.656859 #129]  INFO -- : [knapsack_pro] bundle exec rspec --profile=5 --format documentation --color --format RspecJunitFormatter --out tmp/rspec.xml --default-path spec <<<spec-files-batch-2>
No examples found.

I, [2023-05-19T16:35:11.949911 #129]  INFO -- : [knapsack_pro] To retry the last batch of tests fetched from the API Queue, please run the following command on your machine:
I, [2023-05-19T16:35:11.949998 #129]  INFO -- : [knapsack_pro] bundle exec rspec --profile=5 --format documentation --color --format RspecJunitFormatter --out tmp/rspec.xml --default-path spec <<<spec-files-batch-3>>>
No examples found.

...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions