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

Test initialization refactor #563

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

randalldfloyd
Copy link
Contributor

@randalldfloyd randalldfloyd commented Aug 15, 2023

This PR gets the log_in_as specs passing, which started consistently failing after measures were put in place to ensure proper creation of default admin set/permission templates. It was failing while waiting for a lock on the User table:

ActiveRecord::LockWaitTimeout:
       Mysql2::Error::TimeoutError: Lock wait timeout exceeded; try restarting transaction: INSERT INTO `users` (`email`, `created_at`, `updated_at`, `provider`, `uid`) VALUES ('user130@example.com', '2023-08-11 19:54:15', '2023-08-11 19:54:15', 'cas', 'username130')
     # ./spec/features/log_in_as_spec.rb:4:in `block (2 levels) in <top (required)>'
     # ./spec/features/log_in_as_spec.rb:8:in `block (3 levels) in <top (required)>

I wasn't able to determine what was really holding the database lock, but I was able to get past it by increasing the INNODB lock timeout (default is 50 seconds) in the test database configuration. This has resulted in at least a 50 second wait in the suite, which you can see at work in the test analysis. It points at the "login as" specs as being the second slowest example, when in actuality it's really just waiting for the lock on the User table to be released:

Top 10 slowest examples (426.94 seconds, 51.7% of total time):
  Jasmine expects all jasmine tests to pass
    180.86 seconds ./spec/javascripts/jasmine_spec.rb:14
  Switch User Non-admin user is not allowed to see switch user form
    54.43 seconds ./spec/features/log_in_as_spec.rb:10
...

Without this fix, the example run above would have failed on the "Switch User" test because it was 4 seconds over the default lock timeout. This also sends the clean directive on the test examples, which didn't help anything, but is consistent with other specs in the suite.

@randalldfloyd randalldfloyd merged commit 6a2e1a0 into test-iiif_print Aug 15, 2023
@randalldfloyd randalldfloyd deleted the test-initialization_refactor branch August 15, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant