krkn_lib.tests.test_krkn_telemetry_openshift module

class krkn_lib.tests.test_krkn_telemetry_openshift.TestCollectClusterMetadata(methodName='runTest')

Bases: TestCase

test_collects_metadata_successfully(mock_get_vm, mock_get_build, mock_get_route)

Populates chaos_telemetry with metadata successfully.

test_does_not_add_vmi_count_when_zero(mock_get_vm, mock_get_build, mock_get_route)

VirtualMachineInstance key is absent when vm_number returns 0.

test_handles_exceptions_gracefully(mock_get_vm, mock_get_build, mock_get_route)

Exceptions in timed methods do not crash and leave fields as None.

class krkn_lib.tests.test_krkn_telemetry_openshift.TestGetBuildCount(methodName='runTest')

Bases: TestCase

test_empty_build_list_returns_zero()

Empty cluster returns 0.

test_exception_returns_zero_and_logs(mock_logging)

Exception returns 0 and logs the error message.

test_paginates_across_pages()

Follows continue token and sums items across pages.

test_returns_correct_count()

Returns count from a single-page cluster-wide response.

class krkn_lib.tests.test_krkn_telemetry_openshift.TestGetLibOcp(methodName='runTest')

Bases: TestCase

test_returns_ocpcli()

Returns the internal __ocpcli assigned during initialization.

class krkn_lib.tests.test_krkn_telemetry_openshift.TestGetOcpPrometheusData(methodName='runTest')

Bases: TestCase

test_delegates_to_kubernetes_prometheus_with_ocp_defaults(mock_get_pod_data)

Invokes get_prometheus_pod_data with specific OpenShift strings.

class krkn_lib.tests.test_krkn_telemetry_openshift.TestGetRouteCount(methodName='runTest')

Bases: TestCase

test_empty_route_list_returns_zero()

Empty cluster returns 0.

test_exception_returns_zero_and_logs(mock_logging)

Exception returns 0 and logs the error message.

test_paginates_across_pages()

Follows continue token and sums items across pages.

test_returns_correct_count()

Returns count from a single-page cluster-wide response.

class krkn_lib.tests.test_krkn_telemetry_openshift.TestGetVmNumber(methodName='runTest')

Bases: TestCase

test_empty_vmi_list_returns_zero()

Empty cluster returns 0.

test_exception_returns_zero_and_logs(mock_logging)

Exception returns 0 and logs the error message.

test_paginates_across_pages()

Follows continue token and sums items across pages.

test_returns_correct_count()

Returns count from a single-page cluster-wide response.

class krkn_lib.tests.test_krkn_telemetry_openshift.TestPutOcpLogs(methodName='runTest')

Bases: TestCase

test_raises_when_api_url_has_invalid_scheme()

Raises Exception when api_url does not start with http/https.

test_raises_when_api_url_has_no_scheme()

Raises Exception when api_url is a bare hostname with no scheme.

test_raises_when_archive_path_missing()

Raises Exception when archive_path is absent from config.

test_raises_when_backup_threads_is_string()

Raises Exception when backup_threads is a string, not an int.

test_raises_when_backup_threads_missing()

Raises Exception when backup_threads is absent, not also a type error.

test_raises_when_logs_backup_missing()

Raises Exception when logs_backup is absent from config.

test_raises_when_logs_filter_patterns_missing()

Raises Exception when logs_filter_patterns is absent, not also a type error.

test_raises_when_logs_filter_patterns_not_a_list()

Raises Exception when logs_filter_patterns is a string, not a list.

test_raises_when_max_retries_missing()

Raises Exception when max_retries is absent from config.

test_raises_when_password_missing()

Raises Exception when password is absent from config.

test_raises_when_username_missing()

Raises Exception when username is absent from config.

test_raises_with_all_missing_fields_joined()

Single exception message contains all missing field names joined.

test_skips_when_api_url_is_empty_string()

Returns early and logs info when api_url is an empty string.

test_skips_when_api_url_is_none()

Returns early and logs info when api_url is None.

test_skips_when_logs_backup_is_false()

Returns early and logs info when logs_backup is False.