Project

General

Profile

Actions

Patch #32122

closed

Fix test failure due to missing call to set_tmp_attachments_directory

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

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

0%

Estimated time:

Description

https://www.redmine.org/builds/logs/build_trunk_postgresql_ruby-2.4_583.html

...F

Failure:
AttachmentsControllerTest#test_download_should_assign_content_type_if_blank [/var/lib/jenkins/workspace/trunk/DATABASE_ADAPTER/postgresql/RUBY_VER/ruby-2.4/test/functional/attachments_controller_test.rb:345]:
Expected response to be a <2XX: success>, but was a <404: Not Found>

bin/rails test test/functional/attachments_controller_test.rb:339

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

Failure:
Redmine::ApiTest::AttachmentsTest#test_GET_/attachments/thumbnail/:id_should_return_the_thumbnail [/var/lib/jenkins/workspace/trunk/DATABASE_ADAPTER/postgresql/RUBY_VER/ruby-2.4/test/integration/api_test/attachments_test.rb:83]:
Expected response to be a <2XX: success>, but was a <404: Not Found>

bin/rails test test/integration/api_test/attachments_test.rb:80

...F

Failure:
Redmine::ApiTest::AttachmentsTest#test_GET_/attachments/:id.xml_for_image_should_include_thumbnail_url [/var/lib/jenkins/workspace/trunk/DATABASE_ADAPTER/postgresql/RUBY_VER/ruby-2.4/test/integration/api_test/attachments_test.rb:54]:
Expected response to be a <2XX: success>, but was a <404: Not Found>
Response body: 

bin/rails test test/integration/api_test/attachments_test.rb:52

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

Failure:
ApplicationHelperTest#test_attached_images_should_read_later [/var/lib/jenkins/workspace/trunk/DATABASE_ADAPTER/postgresql/RUBY_VER/ruby-2.4/test/helpers/application_helper_test.rb:249]:
Expected false to be truthy.

bin/rails test test/helpers/application_helper_test.rb:245

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

Failure:
AttachmentsTest#test_download_should_set_sendfile_header [/var/lib/jenkins/workspace/trunk/DATABASE_ADAPTER/postgresql/RUBY_VER/ruby-2.4/test/integration/attachments_test.rb:153]:
Expected response to be a <2XX: success>, but was a <404: Not Found>

bin/rails test test/integration/attachments_test.rb:148

I think the reason why the test failed is that Attachments under test/fixtures/files/ is missing.
I think I should call to set_tmp_attachments_directory . I attached a patch.


Files

Actions #1

Updated by Go MAEDA over 4 years ago

  • Target version set to Candidate for next major release
Actions #2

Updated by Go MAEDA over 4 years ago

  • Assignee set to Go MAEDA
  • Target version changed from Candidate for next major release to 4.2.0

LGTM. Setting the target version to 4.2.0.

set_tmp_attachments_directory and set_fixtures_attachments_directory are methods which change Attachment.storage_path during tests.

If a test method which creates/deletes attachments, set_tmp_attachments_directory has to be called at the beginning of the method in order not to destroy the contents in test/fixtures/files directory. Some test methods which uses files in test/fixtures/files call set_fixtures_attachments_directory in order to set Attachment.storage_path to test/fixtures/files. Those test methods should call set_tmp_attachments_directory at the end. Otherwise, you may observe some test failures.

This patch ensures calling set_tmp_attachments_directory in some tests, in order to fix test failures which occurs occasionally.

Actions #3

Updated by Go MAEDA over 4 years ago

  • Subject changed from Add call to set_tmp_attachments_directory to Fix test failure due to missing call to set_tmp_attachments_directory
Actions #4

Updated by Go MAEDA over 4 years ago

  • Status changed from New to Closed
  • Target version changed from 4.2.0 to 4.1.0

Committed the patch. Thank you for investigating the test failure.

Actions

Also available in: Atom PDF