#832 Five slow tests.
Closed: Fixed 6 years ago Opened 6 years ago by ralph.

I ran the MBS test suite with --durations=0 to print out a list of how long each test took, and five of them stand out as taking much longer than the others.

  • 60.17s call tests/test_scm.py::TestSCMModule::test_get_latest_incorect_component_ref
  • 60.15s call tests/test_scm.py::TestSCMModule::test_get_latest_incorect_component_branch
  • 60.14s call tests/test_scm.py::TestSCMModule::test_verify_unknown_branch
  • 60.13s call tests/test_scm.py::TestSCMModule::test_local_get_latest_unclean_input
  • 60.12s call tests/test_scm.py::TestSCMModule::test_verify_unknown_hash

We should speed those up; make development easier.


OK, all of these are hobbled by a retry(...) decorator with hardcoded timeouts. We want those to be relatively long in prod and relatively short in test and dev.

Unfortunately, there is no easy way to mock vars inside a closure in python.

I'm opting here for the simplest route: just use the system-default timeouts. They are a little longer in prod than we'd like.. but the tests run in just a few seconds now.

See #834.

After #834, the slowest tests are:

============================================================================================= slowest test durations ==============================================================================================
10.73s call     tests/test_build/test_build.py::TestBuild::test_submit_build_resume_failed_init
7.17s call     tests/test_build/test_build.py::TestBuild::test_submit_build_instant_complete
6.97s call     tests/test_build/test_build.py::TestBuild::test_submit_build_from_yaml_allowed
6.75s call     tests/test_build/test_build.py::TestBuild::test_submit_build_resume_init_fail
6.40s call     tests/test_build/test_build.py::TestBuild::test_submit_build_concurrent_threshold
6.30s call     tests/test_build/test_build.py::TestBuild::test_submit_build
6.18s call     tests/test_build/test_build.py::TestBuild::test_all_builds_in_batch_fail
6.11s call     tests/test_build/test_build.py::TestBuild::test_build_in_batch_fails
5.97s call     tests/test_build/test_build.py::TestBuild::test_submit_build_cancel
5.17s call     tests/test_build/test_build.py::TestBuild::test_try_to_reach_concurrent_threshold
5.10s call     tests/test_build/test_build.py::TestLocalBuild::test_submit_build_local_dependency
4.85s call     tests/test_build/test_build.py::TestBuild::test_submit_build_no_components
3.90s call     tests/test_scheduler/test_module_init.py::TestModuleInit::test_init_when_get_latest_raises
3.88s call     tests/test_scheduler/test_module_init.py::TestModuleInit::test_init_basic
3.87s call     tests/test_scheduler/test_module_init.py::TestModuleInit::test_init_includedmodule
3.82s call     tests/test_scheduler/test_module_init.py::TestModuleInit::test_init_scm_not_available
3.27s call     tests/test_builder/test_koji.py::TestKojiBuilder::test_buildroot_ready
3.10s call     tests/test_scm.py::TestSCMModule::test_local_get_latest_unclean_input
3.08s call     tests/test_scm.py::TestSCMModule::test_get_latest_incorect_component_ref
3.08s call     tests/test_scm.py::TestSCMModule::test_verify_unknown_branch
3.07s call     tests/test_scm.py::TestSCMModule::test_get_latest_incorect_component_branch
3.07s call     tests/test_scm.py::TestSCMModule::test_verify_unknown_hash
2.30s call     tests/test_build/test_build.py::TestBuild::test_submit_build_resume_recover_orphaned_macros
2.13s call     tests/test_build/test_build.py::TestBuild::test_submit_build_resume
2.06s call     tests/test_build/test_build.py::TestBuild::test_submit_build_reuse_all
1.93s call     tests/test_build/test_build.py::TestBuild::test_submit_build_reuse_all_without_build_macros
1.92s call     tests/test_models/test_models.py::TestModels::test_app_sqlalchemy_events
1.62s call     tests/test_utils/test_utils.py::TestUtils::test_format_mmd_empty_scmurl
1.53s call     tests/test_utils/test_utils.py::TestUtils::test_record_component_builds_duplicate_components
1.45s call     tests/test_utils/test_utils.py::TestUtils::test_get_reusable_component_shared_userspace_ordering
1.35s call     tests/test_utils/test_utils.py::TestUtils::test_record_component_builds_set_weight
1.30s call     tests/test_utils/test_utils.py::TestUtils::test_format_mmd

... which, while not perfect, is much better.

Login to comment on this ticket.

Metadata