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

Fix flaky GraduationJob test #2183

Closed
mark-dce opened this issue Oct 13, 2021 · 2 comments
Closed

Fix flaky GraduationJob test #2183

mark-dce opened this issue Oct 13, 2021 · 2 comments
Labels

Comments

@mark-dce
Copy link
Contributor

ISSUE
We're seeing the following failure intermittently:

Failure/Error:
  next if Hyrax::PermissionTemplateAccess
            .find_by(permission_template_id: admin_set.permission_template.id,
                     agent_id:   'registered',
                     access:     'deposit',
                     agent_type: 'group')

ActiveRecord::RecordNotFound:
  Couldn't find Hyrax::PermissionTemplate
./lib/workflow_setup.rb:156:in `block in everyone_can_deposit_everywhere'
./lib/workflow_setup.rb:154:in `everyone_can_deposit_everywhere'
./lib/workflow_setup.rb:44:in `setup'
./spec/jobs/graduation_job_with_embargo_spec.rb:46:in `block (3 levels) in <top (required)>'

e.g. https://app.circleci.com/pipelines/github/curationexperts/laevigata/504/workflows/bd115b16-c926-461a-b739-cb9c864d3763/jobs/536/tests#failed-test-0

This appears not to be occurring in the tests themselves, but in the setup block here
https://github.com/curationexperts/laevigata/blob/main/spec/jobs/graduation_job_with_embargo_spec.rb#L45-L47

When the Hyrax::PermissionTemplate class can't be found (isn't loaded), it causes all tests in the context to fail.

@mark-dce mark-dce added the bug label Oct 13, 2021
@mark-dce
Copy link
Contributor Author

This appears to be occurring based on the randomized order of previous tests that may or may not be flagged clean: true. It appear that running ActiveFedora::Cleaner.clean! once before the workflow setup ensures consistent state for the workflows to be setup and subsequent tests to be run.

@mark-dce
Copy link
Contributor Author

Fixed in #2185

@norm0 norm0 closed this as completed Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants