Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SupplyItemTest#test_deletion_of_project_should_delete_supply_items failed randomly when using S3 plugin with dummy test configuration #10

Open
sanak opened this issue May 23, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sanak
Copy link
Member

sanak commented May 23, 2022

Problem
When using redmica_s3 plugin with dummy test configuration,

--- a/config/s3.yml
+++ b/config/s3.yml
+
+# Uncomment this to run plugin tests with standard redmine script
+test:
+  access_key_id: S3_ACCESS_KEY_ID
+  secret_access_key: S3_SECRET_ACCESS_KEY
+  bucket: S3_BUCKET_NAME

I encountered the following error.

% RAILS_ENV=test NAME=redmine_supply bundle exec rake redmine:plugins:test
Unknown database adapter `postgis` found in config/database.yml, use Gemfile.local to load your own database gems
Run options: --seed 14332

# Running:

.................E

Error:
SupplyItemTest#test_deletion_of_project_should_delete_supply_items:
Aws::S3::Errors::PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
    plugins/redmica_s3/lib/redmica_s3/connection.rb:79:in `delete'
    plugins/redmica_s3/lib/redmica_s3/attachment_patch.rb:244:in `delete_from_disk!'
    app/models/attachment.rb:172:in `delete_from_disk'
    plugins/redmine_supply/test/unit/supply_item_test.rb:59:in `block (2 levels) in <class:SupplyItemTest>'
    plugins/redmine_supply/test/unit/supply_item_test.rb:58:in `block in <class:SupplyItemTest>'


rails test plugins/redmine_supply/test/unit/supply_item_test.rb:56
:

To Reproduce
Execute the following command with using redmica_s3 plugin's dummy test configuration.

% RAILS_ENV=test NAME=redmine_supply bundle exec rake redmine:plugins:test

Expectation
The test should pass always.

@sanak sanak added the bug Something isn't working label May 23, 2022
@sanak sanak self-assigned this May 23, 2022
@sanak sanak changed the title SupplyItemTest#test_deletion_of_project_should_delete_supply_items failed randomly when using S3 plugin + dummy configuration SupplyItemTest#test_deletion_of_project_should_delete_supply_items failed randomly when using S3 plugin with dummy test configuration May 23, 2022
@sanak
Copy link
Member Author

sanak commented May 23, 2022

Well, easiest fix is just deleting original fixture's attachments at the setup of the test as follows, but probably it is not the best solution, because supply => s3 plugin dependency is not preferable.

--- a/test/unit/supply_item_test.rb
+++ b/test/unit/supply_item_test.rb
@@ -5,6 +5,7 @@ class SupplyItemTest < ActiveSupport::TestCase
 
   setup do
     @project = Project.find 'ecookbook'
+    Attachment.delete_all
   end
 
   test 'should find items' do

The complex thing is that Redmine fixtures doesn't include actual attachments files, so this may be rather s3 plugin side work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant