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

Various test speed ups #3465

Merged
merged 15 commits into from Jun 13, 2017
Merged

Various test speed ups #3465

merged 15 commits into from Jun 13, 2017

Conversation

Kami
Copy link
Member

@Kami Kami commented Jun 12, 2017

This pull request contains speed ups for various "offensive" tests which took a long time.

For information on how speed ups were achieved, please refer to the actual git commit messages and code changes (and ask for clarification, if needed).

Speed ups

Before

(virtualenv)vagrant@vagrant-ubuntu-trusty-64:/data/stanley$ nosetests --with-timer --nocapture -v st2common/tests/unit/test_virtualenvs.py
test_setup_pack_virtualenv_already_exists (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (8.5302s)
test_setup_pack_virtualenv_doesnt_exist_yet (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (5.0522s)
test_setup_virtualenv_invalid_dependency_in_requirements_file (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (10.7242s)
test_setup_virtualenv_update (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (5.6160s)

[success] 35.84% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_virtualenv_invalid_dependency_in_requirements_file: 10.7242s
[success] 28.51% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_pack_virtualenv_already_exists: 8.5302s
[success] 18.77% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_virtualenv_update: 5.6160s
[success] 16.88% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_pack_virtualenv_doesnt_exist_yet: 5.0522s
----------------------------------------------------------------------
Ran 4 tests in 29.929s

After:

(virtualenv)vagrant@vagrant-ubuntu-trusty-64:/data/stanley$ nosetests --with-timer --nocapture -v st2common/tests/unit/test_virtualenvs.py
test_setup_pack_virtualenv_already_exists (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (0.2725s)
test_setup_pack_virtualenv_doesnt_exist_yet (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (0.1489s)
test_setup_virtualenv_invalid_dependency_in_requirements_file (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (3.1897s)
test_setup_virtualenv_update (tests.unit.test_virtualenvs.VirtualenvUtilsTestCase) ... ok (3.7518s)

[success] 50.96% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_virtualenv_update: 3.7518s
[success] 43.32% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_virtualenv_invalid_dependency_in_requirements_file: 3.1897s
[success] 3.70% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_pack_virtualenv_already_exists: 0.2725s
[success] 2.02% tests.unit.test_virtualenvs.VirtualenvUtilsTestCase.test_setup_pack_virtualenv_doesnt_exist_yet: 0.1489s
----------------------------------------------------------------------
Ran 4 tests in 7.368s

OK

Kami added 10 commits June 12, 2017 16:12
This way no requirements are installed in a created virtualenv which
speeds up tests.
don't need it.

This speeds up test run by 90% or so.
disks.

We have way too many test fixture packs on disk and registering
resources from all inside the test takes a long time.

With this change tests are now substantially faster.
@@ -10,6 +10,8 @@ machine:
# We add /tmp/mongodb/bin/ directory to PATH so the correct and latest version of mongo shell
# binary is used.
PATH: /tmp/mongodb/bin/:${PATH}
# Enable nose timing info so per test case test timing is printed at the end
NOSE_TIME: "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+100.

@Kami Kami mentioned this pull request Jun 13, 2017
@Kami Kami changed the title [WIP] Various test speed ups Various test speed ups Jun 13, 2017
@Kami Kami merged commit f3df575 into master Jun 13, 2017
@Kami Kami deleted the test_speed_ups branch June 13, 2017 12:35
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.

None yet

3 participants