diff options
author | Stan Hu <stanhu@gmail.com> | 2016-09-08 03:37:41 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-09-08 03:37:41 +0300 |
commit | 43d6328fbc40e95999fcbb2cdbd5932d7dc799ad (patch) | |
tree | 5eb02e7b033a42d0b94e95b76d6422b6c9c2b93f /spec/services/issues/bulk_update_service_spec.rb | |
parent | fc0ceb20bf299a6fa19d18bc38de26fdf890ce69 (diff) | |
parent | 49ea6ac76fc2f3db018abcf624825c1fb5256fd7 (diff) |
Merge branch 'fix-random-failing-tests' into 'master'
Fix randomly failing specs (possibly caused by DatabaseCleaner)
## What does this MR do?
This MR ensures that DatabaseCleaner.clean runs AFTER Capybara's cleanup. This is needed because it *seems* like database is being truncated before capybara session ends, which leads to `undefined method ... for nil:NilClass` exceptions causing tests to randomly fail.
## Are there points in the code the reviewer needs to double check?
Failing spec is https://gitlab.com/gitlab-org/gitlab-ce/blob/master/spec/features/boards/boards_spec.rb. Here are some examples of failed builds:
- https://gitlab.com/gitlab-org/gitlab-ce/builds/3352437
- https://gitlab.com/certik/gitlab-ce/builds/3359940
- https://gitlab.com/gitlab-org/gitlab-ee/builds/3365914
## Why was this MR needed?
I've noticed that many branches suffer from random failures and it's not very comfortable for big test suite. Re-running builds until they pass is not a solution so I tried to come up with a fix. Unfortunately I can't be 100% sure about this fix (flaky test is always green on my local environment, so I can't be sure if green build on CI is false-positive or not), but if database is really being cleaned too early (which is clearly proved by logs provided here https://gitlab.com/gitlab-org/gitlab-ce/issues/21841#note_14926675 then it's very likely that this fix will help to get rid of random failures.
Also it's officially recommended in DatabaseCleaner README to use `append_after` hook instead of just `after` because of the way RSpec runs after hooks (in reverse order):
> It's also recommended to use append_after to ensure DatabaseCleaner.clean runs after the after-test cleanup capybara/rspec installs.
([source](https://github.com/DatabaseCleaner/database_cleaner#rspec-with-capybara-example))
## What are the relevant issue numbers?
#21197
See merge request !6198
Diffstat (limited to 'spec/services/issues/bulk_update_service_spec.rb')
0 files changed, 0 insertions, 0 deletions