Patch #33938

Add missing fixtures to IssueNestedSetTest

Added by Yuichi HARADA about 1 month ago. Updated about 1 month ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Code cleanup/refactoring
Target version:-

Description

Sometimes IssueNestedSetTest fails.

$ RAILS_ENV=test bundle exec rake db:migrate:reset

$ RAILS_ENV=test bundle exec rake test
Run options: --seed 43474

# Running:

............F

Failure:
IssueNestedSetTest#test_destroy_should_destroy_children [./test/unit/issue_nested_set_test.rb:225]:
"JournalDetail.count" didn't change by -1.
Expected: 7
  Actual: 6

bin/rails test test/unit/issue_nested_set_test.rb:216

.........F

Failure:
IssueNestedSetTest#test_destroy_child_issue_with_children [./test/unit/issue_nested_set_test.rb:270]:
"JournalDetail.count" didn't change by -1.
Expected: 7
  Actual: 6

bin/rails test test/unit/issue_nested_set_test.rb:262

........

Finished in 410.935528s, 12.2404 runs/s, 56.5588 assertions/s.
5030 runs, 23242 assertions, 2 failures, 0 errors, 3 skips

You have skipped tests. Run with --verbose for details.
$
<pre>

fixed-33938.patch Magnifier (514 Bytes) Yuichi HARADA, 2020-09-01 05:10

History

#1 Updated by Yuichi HARADA about 1 month ago

I think that because of the fixtures are not enough.

diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb
index 3c6f46adf..c79ff48cc 100644
--- a/test/unit/issue_nested_set_test.rb
+++ b/test/unit/issue_nested_set_test.rb
@@ -24,7 +24,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase
            :trackers, :projects_trackers,
            :issue_statuses, :issue_categories, :issue_relations,
            :enumerations,
-           :issues
+           :issues, :journals, :journal_details

   def setup
     User.current = nil

#2 Updated by Go MAEDA about 1 month ago

I cannot reproduce the problem.

$ RAILS_ENV=test bin/rake db:reset
$ ruby test/unit/issue_nested_set_test.rb
Run options: --seed 59495

# Running:

.......................

Finished in 7.030327s, 3.2715 runs/s, 8.9612 assertions/s.
23 runs, 63 assertions, 0 failures, 0 errors, 0 skips

#3 Updated by Yuichi HARADA about 1 month ago

Go MAEDA wrote:

I cannot reproduce the problem.

[...]

You can reproduce it by testing as follows. I think it's because of the order in which the tests are run.

$ RAILS_ENV=test bundle exec rake db:migrate:reset

$ RAILS_ENV=test bundle exec rake test TESTOPTS="--seed 43474" 
Run options: --seed 43474

# Running:

....F

Failure:
IssueNestedSetTest#test_destroy_should_destroy_children [/Users/harada/_work_/redmine/git/dev-trunk/test/unit/issue_nested_set_test.rb:225]:
"JournalDetail.count" didn't change by -1.
Expected: 7
  Actual: 6

bin/rails test test/unit/issue_nested_set_test.rb:216

..........F

Failure:
IssueNestedSetTest#test_destroy_child_issue_with_children [/Users/harada/_work_/redmine/git/dev-trunk/test/unit/issue_nested_set_test.rb:270]:
"JournalDetail.count" didn't change by -1.
Expected: 7
  Actual: 6

bin/rails test test/unit/issue_nested_set_test.rb:262

.............

Finished in 405.463254s, 12.4031 runs/s, 57.2555 assertions/s.
5029 runs, 23215 assertions, 2 failures, 0 errors, 7 skips

Also available in: Atom PDF