Project

General

Profile

Actions

Patch #41623

open

Fix tests that randomly failed due to required fixtures not being loaded

Added by Katsuya HIDAKA 2 days ago. Updated 2 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

This patch fixes tests that randomly failed due to required fixtures not being loaded.

Below are failure logs of these tests.

    Error:
    Redmine::ApiTest::UsersTest#test_GET_/users/:id.json_with_include=auth_source_should_include_auth_source_for_administrators:
    NoMethodError: undefined method `id' for nil
        test/integration/api_test/users_test.rb:233:in `block in
    <class:UsersTest>'

    bin/rails test test/integration/api_test/users_test.rb:225
    Error:
    Redmine::NumericFieldFormatTest#test_integer_field_should_format_with_thousands_delimiter:
    ActiveRecord::RecordNotFound: Couldn't find Issue with 'id'=1
        test/unit/lib/redmine/field_format/numeric_format_test.rb:66:in
    `test_integer_field_should_format_with_thousands_delimiter'

    bin/rails test
    test/unit/lib/redmine/field_format/numeric_format_test.rb:64
    Failure:
    ChangesetTest#test_ref_keywords_closing_with_timelog
    [test/unit/changeset_test.rb:169]:
    Expected false to be truthy.

    bin/rails test test/unit/changeset_test.rb:153

The changeset_test is failing with a validation error due to the version fixture not being loaded.

From: /redmine/app/models/changeset.rb @ line 260 :

    255:
Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,
    256:                             {:changeset => self, :issue =>
issue, :action => action})
    257:
    258:     if issue.changes.any?
    259:       unless issue.save
 => 260:         binding.irb
    261:         logger.warn("Issue ##{issue.id} could not be saved by
changeset #{id}: #{issue.errors.full_messages}") if logger
    262:       end
    263:     else
    264:       issue.clear_journal
    265:     end

irb(#<Changeset:0x000073145f1036a0>):001> issue.id
=> 2
irb(#<Changeset:0x000073145f1036a0>):002> issue.errors.full_messages
=> ["Target version is not included in the list"]

Files

Actions

Also available in: Atom PDF