edx_django_utils.monitoring.tests package

Contents

edx_django_utils.monitoring.tests package#

Subpackages#

Submodules#

edx_django_utils.monitoring.tests.test_backends module#

Tests for TelemetryBackend and implementations.

class edx_django_utils.monitoring.tests.test_backends.TestBackendsConfig(methodName='runTest')#

Bases: TestCase

Test configuration of the backends list.

test_configured_backends_1__None____NewRelicBackend___(setting, expected_classnames)#

Test that backends are loaded as expected.

test_configured_backends_2_________(setting, expected_classnames)#

Test that backends are loaded as expected.

test_configured_backends_3____edx_django_utils_monitoring_OpenTelemetryBackend______OpenTelemetryBackend___(setting, expected_classnames)#

Test that backends are loaded as expected.

test_configured_backends_4____edx_django_utils_monitoring_NewRelicBackend____edx_django_utils_monitoring_OpenTelemetryBackend____edx_django_utils_monitoring_DatadogBackend______NewRelicBackend____OpenTelemetryBackend____DatadogBackend___(setting, expected_classnames)#

Test that backends are loaded as expected.

test_default_config()#

We need to keep the same unconfigured default for now.

test_import_failure(mock_log)#

Test that backends that can’t be imported are ignored, with warning.

test_newrelic_package(mock_log)#

Test that New Relic backend is skipped if package not present.

test_type()#

Test that we detect the misuse of a string instead of a list.

test_wrong_class(mock_log)#

Test that backend classes of an unexpected ancestor are ignored, with warning.

class edx_django_utils.monitoring.tests.test_backends.TestBackendsFanOut(methodName='runTest')#

Bases: TestCase

Test that certain utility functions fan out to the backends.

test_record_exception(mock_dd_span, mock_otel_record_exception, mock_nr_record_exception)#
test_set_custom_attribute(mock_dd_root_span, mock_otel_set_attribute, mock_nr_add_custom_parameter)#

edx_django_utils.monitoring.tests.test_middleware module#

edx_django_utils.monitoring.tests.test_monitoring_support module#

Tests for MonitoringSupportMiddleware and associated utilities.

Note: See test_middleware.py for the rest of the middleware tests.

class edx_django_utils.monitoring.tests.test_monitoring_support.TestMonitoringSupportMiddleware(methodName='runTest')#

Bases: TestCase

Test the monitoring_utils middleware and helpers

catch_signal(signal)#

Catch django signal and return the mocked handler.

setUp()#

Hook method for setting up the test fixture before exercising it.

test_accumulate_and_increment_1(cached_monitoring_middleware_class, is_deprecated, middleware_method_name, mock_newrelic_agent)#

Test normal usage of collecting custom attributes and reporting to New Relic

test_accumulate_and_increment_2(cached_monitoring_middleware_class, is_deprecated, middleware_method_name, mock_newrelic_agent)#

Test normal usage of collecting custom attributes and reporting to New Relic

test_accumulate_and_increment_3(cached_monitoring_middleware_class, is_deprecated, middleware_method_name, mock_newrelic_agent)#

Test normal usage of collecting custom attributes and reporting to New Relic

test_accumulate_with_illegal_value_1(cached_monitoring_middleware_class, is_deprecated, mock_newrelic_agent)#

Test monitoring accumulate with illegal value that can’t be added.

test_accumulate_with_illegal_value_2(cached_monitoring_middleware_class, is_deprecated, mock_newrelic_agent)#

Test monitoring accumulate with illegal value that can’t be added.

test_deprecated_accumulate(mock_accumulate)#
test_deprecated_increment(mock_increment)#
test_deprecated_set_custom_attribute(mock_set_custom_attribute)#
test_deprecated_set_custom_attributes_for_course_key(mock_set_custom_attributes_for_course_key)#
test_error_tagging(mock_get_root_span)#
test_process_exception_signal()#

Test middleware sends process exception signal.

test_process_request_signal()#

Test middleware sends process request signal.

test_process_response_signal()#

Test middleware sends process response signal.

Module contents#