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

Speed up embargo tests #2189

Merged
merged 1 commit into from
Oct 15, 2021
Merged

Speed up embargo tests #2189

merged 1 commit into from
Oct 15, 2021

Conversation

mark-dce
Copy link
Contributor

Previously, the embargo tests were running expensive setup once for
test example. This change refactors the setup to only run once per
test group. Overall, this results in over 50% faster testing time.

BEFORE

% bundle exec rspec ./spec/system/embargo_show_spec.rb
Run options: exclude {:smoke_test=>true}

Randomized with seed 38550
.....

Top 5 slowest examples (396.2 seconds, 100.0% of total time):
  Display an ETD with embargoed content viewed by depositor pre-graduation
    93.76 seconds ./spec/system/embargo_show_spec.rb:62
  Display an ETD with embargoed content viewed by unauthenticated user post-graduation
    89.25 seconds ./spec/system/embargo_show_spec.rb:138
  Display an ETD with embargoed content viewed by approver with Versions enabled
    84.82 seconds ./spec/system/embargo_show_spec.rb:109
  Display an ETD with embargoed content viewed by a school approver post-graduation
    64.39 seconds ./spec/system/embargo_show_spec.rb:121
  Display an ETD with embargoed content viewed by approver pre-graduation
    63.98 seconds ./spec/system/embargo_show_spec.rb:87

Finished in 6 minutes 36 seconds (files took 15.28 seconds to load)
5 examples, 0 failures

Randomized with seed 38550

AFTER

% bundle exec rspec ./spec/system/embargo_show_spec.rb --seed 38550
Run options: exclude {:smoke_test=>true}

Randomized with seed 38550
.....

Top 5 slowest examples (72.11 seconds, 54.1% of total time):
  Display an ETD with embargoed content post graduation
    22.21 seconds ./spec/system/embargo_show_spec.rb:112
  Display an ETD with embargoed content viewed by approver pre-graduation
    15.97 seconds ./spec/system/embargo_show_spec.rb:83
  Display an ETD with embargoed content viewed by depositor pre-graduation
    13.81 seconds ./spec/system/embargo_show_spec.rb:61
  Display an ETD with embargoed content base etd has expected embargo values after creation
    10.12 seconds ./spec/system/embargo_show_spec.rb:47
  Display an ETD with embargoed content viewed by approver with Versions enabled
    10 seconds ./spec/system/embargo_show_spec.rb:102

Finished in 2 minutes 13.3 seconds (files took 15.44 seconds to load)
5 examples, 0 failures

Randomized with seed 38550

Previously, the embargo tests were running expensive setup once for
test example.  This change refactors the setup to only run once per
test group.  Overall, this results in over 50% faster testing time.

**BEFORE**
```
% bundle exec rspec ./spec/system/embargo_show_spec.rb
Run options: exclude {:smoke_test=>true}

Randomized with seed 38550
.....

Top 5 slowest examples (396.2 seconds, 100.0% of total time):
  Display an ETD with embargoed content viewed by depositor pre-graduation
    93.76 seconds ./spec/system/embargo_show_spec.rb:62
  Display an ETD with embargoed content viewed by unauthenticated user post-graduation
    89.25 seconds ./spec/system/embargo_show_spec.rb:138
  Display an ETD with embargoed content viewed by approver with Versions enabled
    84.82 seconds ./spec/system/embargo_show_spec.rb:109
  Display an ETD with embargoed content viewed by a school approver post-graduation
    64.39 seconds ./spec/system/embargo_show_spec.rb:121
  Display an ETD with embargoed content viewed by approver pre-graduation
    63.98 seconds ./spec/system/embargo_show_spec.rb:87

Finished in 6 minutes 36 seconds (files took 15.28 seconds to load)
5 examples, 0 failures

Randomized with seed 38550

```

**AFTER**
```
% bundle exec rspec ./spec/system/embargo_show_spec.rb --seed 38550
Run options: exclude {:smoke_test=>true}

Randomized with seed 38550
.....

Top 5 slowest examples (72.11 seconds, 54.1% of total time):
  Display an ETD with embargoed content post graduation
    22.21 seconds ./spec/system/embargo_show_spec.rb:112
  Display an ETD with embargoed content viewed by approver pre-graduation
    15.97 seconds ./spec/system/embargo_show_spec.rb:83
  Display an ETD with embargoed content viewed by depositor pre-graduation
    13.81 seconds ./spec/system/embargo_show_spec.rb:61
  Display an ETD with embargoed content base etd has expected embargo values after creation
    10.12 seconds ./spec/system/embargo_show_spec.rb:47
  Display an ETD with embargoed content viewed by approver with Versions enabled
    10 seconds ./spec/system/embargo_show_spec.rb:102

Finished in 2 minutes 13.3 seconds (files took 15.44 seconds to load)
5 examples, 0 failures

Randomized with seed 38550

```
@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.023% when pulling 18ecff6 on before_all into 5b9807d on main.

@mlooney mlooney merged commit daa0150 into main Oct 15, 2021
@mlooney mlooney deleted the before_all branch October 15, 2021 14:16
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.

3 participants