Comments (2)
For the future reference.
In order to reproduce the problem, raise an exception outside of a test example.
describe 'abc' do
raise 'error'
it do
expect(true).to be true
end
end
When tests fail, then new tests are fetched from Queue API. All tests fail so that means a lot of tests will be fetched quickly from Queue API.
Because of that too many test files are assigned to a given CI node index.
If you retry a CI node (and you use KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
) and connection to DB works fine, then the same set of tests that was assigned to the node in the first place would run. Tests will take a long time because there is a lot of them.
Problem:
knapsack_pro does not know how to catch exceptions from inside of the RSpec process because RSpec already caught the exception, so we don't know if the test failure is a regular failure or not (exception outside of a test example). So Knapsack Pro keeps asking Queue API for more tests instead of failing fast and stopping pulling tests.
Possible solution. Ensure the DB is up and running:
Example for Github Actions:
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ""
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
# tmpfs makes DB faster by using RAM
options: >-
--mount type=tmpfs,destination=/var/lib/postgresql/data
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
Maybe this will be helpful:
https://github.com/orgs/community/discussions/25757
If the problem happens again, you can create a new commit and this will start a new queue so that the tests are distributed in new order.
from knapsack_pro-ruby.
Hi @amanfredi
I'm wondering how to reproduce it. I did
# spec_helper.rb
KnapsackPro::Hooks::Queue.before_queue do |queue_id|
raise 'a'
end
Indeed knapsack pro consumes tests from Queue API and does it fast. It does not execute tests because RSpec could not start tests due to a failure. Tests failed.
CI build should complete work faster when tests are not executed.
I'm not sure why you experienced a timeout from CI? Do you mean you fixed the bug in the code and you started a new build (attempted some kind of retry) and it was split using cached distribution (fixed queue split) so that a single CI node got too many tests (due to them being cached on the API side). If you fixed a bug in the code then I would expect a new git commit hash so that the fixed queue split (cached distribution on API side) won't be used.
Could you give more details on how to reproduce the problem. What you did?
Did you start 1 CI build or maybe 2 because you did a retry? Did you create a new commit?
What would you expect to happen?
from knapsack_pro-ruby.
Related Issues (20)
- Include error messages from dry run json report in stdout when knapsack_pro:rspec_test_example_detector fails HOT 8
- rspec_junit_formatter still producing invalid XML after applying suggestion from #40 HOT 3
- Support for Github Actions job summaries HOT 5
- Queue mode causes rspec_junit_formatter to produce invalid XML when a node runs a spec with all examples commented out. HOT 5
- Thread.join causes knapsack to hang on circleCI HOT 13
- Enabled KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES and now get uninitialized constant at end of run HOT 10
- Regular mode (non-queue) rspec outputs all spec file names on startup HOT 4
- Memory leak HOT 2
- Lots of failures with rolify gem after 4.1 -> 5.0 bump HOT 12
- Docs need to specify ENV var to detect CI provider HOT 1
- Fail gracefully when there's no git HOT 8
- Running `git fetch --shallow-since` to fetch commit author log causes hang on Buildkite runners HOT 12
- rspec-core conflict HOT 4
- Running queue mode locally for troubleshooting with a small subset of tests, but with multiple batches HOT 6
- Does `rake knapsack_pro:rspec_test_example_detector` need to run if there aren't any slow specs? HOT 2
- Slow test analysis runs even when there's no slow tests HOT 2
- Disable example_status_persistence_file_path HOT 3
- Create a replication command on failed node HOT 2
- Incompatibility with rspec --options on 6.0+ HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knapsack_pro-ruby.