Skip to content

Make slow feature spec faster (2.4x faster)

David Dieulivol requested to merge 414929-improve_slow_feature_spec into master

What does this MR do and why?

Closes #414929 (closed).

For this given spec, we were generating a huge dataset to persist into the Rails cache, and to check whether we would render cached data (when the dataset isn't present in the cache, we display an error message to the user).

The change introduced in this commit is to generate a fake dataset to be persisted in the cache, as we don't need to have the real dataset: we just want it to be present in the cache, and we'll return that dataset.

How to set up and validate locally

On master branch

$ be rspec ./spec/features/admin/admin_settings_spec.rb:992 

[...]

Finished in 1 minute 9.7 seconds (files took 11.93 seconds to load)
1 example, 0 failures

On this branch

$ be rspec ./spec/features/admin/admin_settings_spec.rb:1002

[...]

Finished in 28.98 seconds (files took 12.93 seconds to load)
1 example, 0 failures

That is a 2.4x speed improvement 🎉

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports