Show More
@@ -41,6 +41,15 b' def admin_routes(config):' | |||
|
41 | 41 | renderer='json_ext') |
|
42 | 42 | |
|
43 | 43 | config.add_route( |
|
44 | name='ops_celery_error_test', | |
|
45 | pattern='/error-celery') | |
|
46 | config.add_view( | |
|
47 | OpsView, | |
|
48 | attr='ops_celery_error_test', | |
|
49 | route_name='ops_celery_error_test', request_method='GET', | |
|
50 | renderer='json_ext') | |
|
51 | ||
|
52 | config.add_route( | |
|
44 | 53 | name='ops_redirect_test', |
|
45 | 54 | pattern='/redirect') |
|
46 | 55 | config.add_view( |
@@ -66,6 +66,20 b' class OpsView(BaseAppView):' | |||
|
66 | 66 | 'Client:{}. Generation time: {}.'.format(self.request.user, time.time())) |
|
67 | 67 | raise TestException(msg) |
|
68 | 68 | |
|
69 | def ops_celery_error_test(self): | |
|
70 | """ | |
|
71 | Test exception handling and emails on errors | |
|
72 | """ | |
|
73 | from rhodecode.lib.celerylib import tasks, run_task | |
|
74 | ||
|
75 | # add timeout so we add some sort of rate limiter | |
|
76 | time.sleep(2) | |
|
77 | ||
|
78 | msg = ('RhodeCode Enterprise test exception. ' | |
|
79 | 'Client:{}. Generation time: {}.'.format(self.request.user, time.time())) | |
|
80 | celery_task = run_task(tasks.test_celery_exception, msg) | |
|
81 | return {'task': str(celery_task)} | |
|
82 | ||
|
69 | 83 | def ops_redirect_test(self): |
|
70 | 84 | """ |
|
71 | 85 | Test redirect handling |
@@ -403,6 +403,11 b' def sync_last_update_for_objects(*args, ' | |||
|
403 | 403 | |
|
404 | 404 | |
|
405 | 405 | @async_task(ignore_result=True, base=RequestContextTask) |
|
406 | def test_celery_exception(msg): | |
|
407 | raise Exception(f'Test exception: {msg}') | |
|
408 | ||
|
409 | ||
|
410 | @async_task(ignore_result=True, base=RequestContextTask) | |
|
406 | 411 | def sync_last_update(*args, **kwargs): |
|
407 | 412 | sync_last_update_for_objects(*args, **kwargs) |
|
408 | 413 |
General Comments 0
You need to be logged in to leave comments.
Login now