mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
docs-test: Check only http 404 error for external links.
- Raise exception only for http 404 error rensponse, for other http error codes used logging to notify devs about wrong links.
This commit is contained in:
@@ -18,6 +18,8 @@ class StatusCommand(Command):
|
|||||||
self.crawler_process.start()
|
self.crawler_process.start()
|
||||||
# Get exceptions quantity from crawler stat data
|
# Get exceptions quantity from crawler stat data
|
||||||
stats = crawler.stats.get_stats()
|
stats = crawler.stats.get_stats()
|
||||||
if stats.get('spider_exceptions/Exception') or stats.get('downloader/exception_count'):
|
error_404 = 'downloader/response_status_count/404'
|
||||||
|
error_io = 'downloader/exception_type_count/exceptions.IOError'
|
||||||
|
if stats.get(error_404) or stats.get(error_io):
|
||||||
# Return non-zero exit code if exceptions are contained
|
# Return non-zero exit code if exceptions are contained
|
||||||
self.exitcode = 1
|
self.exitcode = 1
|
||||||
|
|||||||
@@ -81,12 +81,11 @@ class DocumentationSpider(scrapy.Spider):
|
|||||||
# type: (Any) -> Optional[Generator[Any, None, None]]
|
# type: (Any) -> Optional[Generator[Any, None, None]]
|
||||||
if hasattr(failure.value, 'response') and failure.value.response:
|
if hasattr(failure.value, 'response') and failure.value.response:
|
||||||
response = failure.value.response
|
response = failure.value.response
|
||||||
if response.status in [500, 502, 503, 504, 429]:
|
if response.status == 404:
|
||||||
self.log("Error! Please check link: {}".format(response), logging.ERROR)
|
raise Exception('Page not found: {}'.format(response))
|
||||||
return None
|
|
||||||
if response.status == 405 and response.request.method == 'HEAD':
|
if response.status == 405 and response.request.method == 'HEAD':
|
||||||
# Method 'HEAD' not allowed, repeat request with 'GET'
|
# Method 'HEAD' not allowed, repeat request with 'GET'
|
||||||
return self.retry_request_with_get(response.request)
|
return self.retry_request_with_get(response.request)
|
||||||
raise Exception(failure.value.response)
|
self.log("Error! Please check link: {}".format(response), logging.ERROR)
|
||||||
else:
|
else:
|
||||||
raise Exception(failure.value)
|
raise Exception(failure.value)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ set -x
|
|||||||
./tools/test-management
|
./tools/test-management
|
||||||
./tools/test-migrations
|
./tools/test-migrations
|
||||||
./tools/test-run-dev
|
./tools/test-run-dev
|
||||||
|
./tools/test-documentation
|
||||||
# Some test suites disabled in CI for being flaky
|
# Some test suites disabled in CI for being flaky
|
||||||
#./tools/test-queue-worker-reload
|
#./tools/test-queue-worker-reload
|
||||||
#./tools/test-documentation
|
|
||||||
|
|||||||
Reference in New Issue
Block a user