Project

General

Profile

Running tests

Added by Dmitry Makurin over 4 years ago

Our setup:

Environment:
  Redmine version                4.0.5.stable
  Ruby version                   2.6.3-p62 (2019-04-16) [x86_64-linux]
  Rails version                  5.2.3
  Environment                    development
  Database adapter               rdb
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.10.0
  Git                            2.20.1
  Filesystem                     
Redmine plugins:
  no plugin installed

When running

rake test RAILS_ENV=test

I've noticed that a lot of assertions are failing on empty array ActionMailer::Base.deliveries.
Changing deliver_later to deliver_now in mailer.rb fixes that problem, but I don't think it's a reliable solution.
What am I missing?


Replies (2)

RE: Running tests - Added by Mayama Takeshi about 1 year ago

Hi, today I tried to run the redmine tests but also got errors.
I tried a single test file for the module I want to contribute to:

[root@lab225201-basix redmine]$ RAILS_ENV=test ruby test/unit/mail_handler_test.rb 
Run options: --seed 30136

# Running:

E

Error:
MailHandlerTest#test_gmail_with_attachment_latin1:
ActiveRecord::StaleObjectError: Stale object error.
    app/models/issue.rb:228:in `create_or_update'
    app/models/mail_handler.rb:222:in `receive_issue'
    app/models/mail_handler.rb:183:in `dispatch_to_default'
    app/models/mail_handler.rb:168:in `dispatch'
    app/models/mail_handler.rb:143:in `receive'
    app/models/mail_handler.rb:53:in `block in receive'
    app/models/mail_handler.rb:50:in `receive'
    test/unit/mail_handler_test.rb:1423:in `submit_email'
    test/unit/mail_handler_test.rb:698:in `test_gmail_with_attachment_latin1'

rails test test/unit/mail_handler_test.rb:695

I believe there is something else that must be setup that is not explained in

https://www.redmine.org/projects/redmine/repository/entry/trunk/doc/RUNNING_TESTS

Can anyone that is able to run redmine tests give some hint?

RE: Running tests - Added by Mayama Takeshi about 1 year ago

Ah, nevermind.
I was testing against revision r22100 that was not at the build page:
https://www.redmine.org/builds/
Using r22112, test/unit/mail_handler_test.rb passed all tests.

    (1-2/2)