mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 20:02:15 +00:00
tests: Optimize test-backend performance.
This optimizes test-backend by skipping webhook tests when run in default mode. Tweaked by tabbott to extend the documentation and update the CI commands.
This commit is contained in:
committed by
Tim Abbott
parent
c78c3f423c
commit
4dc7f5354d
@@ -23,6 +23,7 @@ from zerver.lib import cache
|
||||
from zerver.tornado import event_queue
|
||||
from zerver.tornado.handlers import allocate_handler_id
|
||||
from zerver.worker import queue_processors
|
||||
from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
|
||||
|
||||
from zerver.lib.actions import (
|
||||
get_stream_recipient,
|
||||
@@ -325,7 +326,7 @@ def instrument_url(f: UrlFuncT) -> UrlFuncT:
|
||||
return result
|
||||
return wrapper
|
||||
|
||||
def write_instrumentation_reports(full_suite: bool) -> None:
|
||||
def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> None:
|
||||
if INSTRUMENTING:
|
||||
calls = INSTRUMENTED_CALLS
|
||||
|
||||
@@ -395,7 +396,7 @@ def write_instrumentation_reports(full_suite: bool) -> None:
|
||||
'node-coverage/(?P<path>.*)',
|
||||
'docs/(?P<path>.*)',
|
||||
'casper/(?P<path>.*)',
|
||||
])
|
||||
] + [webhook.url for webhook in WEBHOOK_INTEGRATIONS if not include_webhooks])
|
||||
|
||||
untested_patterns -= exempt_patterns
|
||||
|
||||
|
||||
@@ -434,6 +434,7 @@ class Runner(DiscoverRunner):
|
||||
def run_tests(self, test_labels: List[str],
|
||||
extra_tests: Optional[List[TestCase]]=None,
|
||||
full_suite: bool=False,
|
||||
include_webhooks: bool=False,
|
||||
**kwargs: Any) -> Tuple[bool, List[str]]:
|
||||
self.setup_test_environment()
|
||||
try:
|
||||
@@ -472,7 +473,7 @@ class Runner(DiscoverRunner):
|
||||
self.teardown_test_environment()
|
||||
failed = self.suite_result(suite, result)
|
||||
if not failed:
|
||||
write_instrumentation_reports(full_suite=full_suite)
|
||||
write_instrumentation_reports(full_suite=full_suite, include_webhooks=include_webhooks)
|
||||
return failed, result.failed_tests
|
||||
|
||||
def get_test_names(suite: unittest.TestSuite) -> List[str]:
|
||||
|
||||
Reference in New Issue
Block a user