Project

General

Profile

Actions

Patch #33938

open

Add missing fixtures to IssueNestedSetTest

Added by Yuichi HARADA about 4 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Code cleanup/refactoring
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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>

Files

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

Updated by Yuichi HARADA about 4 years 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
Actions #2

Updated by Go MAEDA about 4 years 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

Actions #3

Updated by Yuichi HARADA about 4 years 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
Actions

Also available in: Atom PDF