-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Labels
testsRelated to tests or testingRelated to tests or testing
Description
The unit testing suite for traefik is probably the largest scenario test battery around.
Today I ran it and I realized it took over a minute and a half to complete, so I decided to profile it.
to produce the profile, run with this tox env:
[testenv:profile-scenario-tests]
description = Profile scenario unit test battery
deps =
pytest
pytest-profiling
ops[testing]>=2.17
-r{toxinidir}/requirements.txt
commands =
pytest -v --tb native {[vars]tst_path}/scenario --profile --profile-svg --log-cli-level=INFO -s {posargs}
There are some obvious candidates for optimization:
- using an in-memory mock for the sqlite db instead of using the real thing could shave off a good chunk of time spent in pointless IO
- A ridiculous amount of time is spent in
State.__new__. Can we do something about that? - how come mocking
juju-logtakes so long? - A single list comprehension in state.py:143 takes 2 seconds of our time: can we lazify some of the code perhaps?
profiling scenario's own test suite yields a very similar picture:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testsRelated to tests or testingRelated to tests or testing
