ocs_ci.utility.tests package

Submodules

ocs_ci.utility.tests.test_azure_utils module

ocs_ci.utility.tests.test_azure_utils.test_azureutil_init_noresourcegroup()

Check that resource group of azure util object is None when this is not specified anywhere.

ocs_ci.utility.tests.test_azure_utils.test_azureutil_init_resourcegroup()

Check that resource group of azure util object can be initialized.

ocs_ci.utility.tests.test_azure_utils.test_azureutil_init_resourcegroup_config()

Check that default resource group of azure util object could be redefined via ocsci config.

ocs_ci.utility.tests.test_deployment_utils module

ocs_ci.utility.tests.test_deployment_utils.test_get_cluster_prefix(cluster_name, expected)

ocs_ci.utility.tests.test_gcp module

ocs_ci.utility.tests.test_gcp.test_gcputil_init_region()

Check that region of gcp util object could be specified via constructor.

ocs_ci.utility.tests.test_gcp.test_gcputil_init_region_config()

Check that region of gcp util object is loaded from via ocsci config when not specified. Moreover if the region is specified directly, the config value should not be used.

ocs_ci.utility.tests.test_prometheus module

ocs_ci.utility.tests.test_prometheus.query_range_result_bad_last_90s(query_range_result_ok)

Range query data with bad values in last 6 values (last 90s of the measurement).

ocs_ci.utility.tests.test_prometheus.query_range_result_delay_60s(query_range_result_ok)

Range query data with bad values in first 4 values (first 60s of the measurement).

ocs_ci.utility.tests.test_prometheus.query_range_result_ok()

Simpified example of data produced by PrometheusAPI.query_range() with ceph_mon_quorum_status query, which performs Prometheus instant query.

ocs_ci.utility.tests.test_prometheus.query_range_result_single_error(query_range_result_ok)

Range query data with one bad value.

ocs_ci.utility.tests.test_prometheus.test_check_query_range_result_exp_delay(query_range_result_delay_60s)

Check that exp_metric_num is taken into account, so that initial bad values are ignored.

ocs_ci.utility.tests.test_prometheus.test_check_query_range_result_exp_good_time(query_range_result_bad_last_90s)

Check that exp_good_time is taken into account, so that initial bad values are ignored if appear after the good time passess.

ocs_ci.utility.tests.test_prometheus.test_check_query_range_result_exp_metric_num(query_range_result_ok)

Check that exp_metric_num is checked as expected when specified.

ocs_ci.utility.tests.test_prometheus.test_check_query_range_result_null()

The function does’t throw any exception and returns true when executed with empty arguments.

ocs_ci.utility.tests.test_prometheus.test_check_query_range_result_simple(query_range_result_ok)

The function validates query_range_result_ok data assuming 1 is a good value.

ocs_ci.utility.tests.test_prometheus.test_check_query_range_result_simple_fail(query_range_result_ok)

Assuming 0 is a good value, the validation should fail.

ocs_ci.utility.tests.test_prometheus.test_check_query_range_result_single_error(query_range_result_single_error)

The function finds single error in query_range_result_single_error data, assuming 1 is a good value.

ocs_ci.utility.tests.test_rgwutils module

ocs_ci.utility.tests.test_rgwutils.test_get_rgw_count(ocs_version, is_upgrade, version_before_upgrade, expected)

ocs_ci.utility.tests.test_utils module

class ocs_ci.utility.tests.test_utils.A(amount)

Bases: object

class ocs_ci.utility.tests.test_utils.B

Bases: object

ocs_ci.utility.tests.test_utils.test_filter_unrepresentable_values(data_to_filter, expected_output)
ocs_ci.utility.tests.test_utils.test_get_attr_chain(chain_length)
ocs_ci.utility.tests.test_utils.test_get_empty_attr()
ocs_ci.utility.tests.test_utils.test_get_none_obj_attr()
ocs_ci.utility.tests.test_utils.test_get_nonexistent_attr_chain(chain_length)
ocs_ci.utility.tests.test_utils.test_mask_secret_nomatch()

Checking that mask_secret function works when there is no match.

ocs_ci.utility.tests.test_utils.test_mask_secret_nosecrets()

Checking that mask_secret function doesn’t change plaintext when secrets are not specified.

ocs_ci.utility.tests.test_utils.test_mask_secret_null()

Checking that mask_secret function works with empty arguments.

ocs_ci.utility.tests.test_utils.test_mask_secret_simple_positive()

Checking that mask_secret function works in a simple positive case.

ocs_ci.utility.tests.test_utils.test_run_cmd_simple_negative(caplog)

Check simple negative use case for run_cmd, including logging.

ocs_ci.utility.tests.test_utils.test_run_cmd_simple_negative_ignoreerror(caplog)

Check simple negative use case for run_cmd with ignore error and logging.

ocs_ci.utility.tests.test_utils.test_run_cmd_simple_negative_with_secrets(caplog)

Check simple negative use case for run_cmd, including logging, when secrets are specified.

ocs_ci.utility.tests.test_utils.test_run_cmd_simple_positive(caplog)

Check simple positive use case for run_cmd, including logging.

ocs_ci.utility.tests.test_utils.test_run_cmd_simple_positive_with_secrets(caplog)

Check simple positive use case for run_cmd, including logging, when secrets are specified.

ocs_ci.utility.tests.test_utils_timeout_sampler module

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ti_func_values()

Iterate over results of a simple TimeoutIterator instance when function args and kwargs are specified.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_func_exception(caplog)

Check that TimeoutSampler handles exception raised during iteration.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_null(timeout_cls)

Creating TimeoutSampler without any parameters should fail on TypeError.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_one_iteration()

When timeout == sleep_time, one iteration should happen.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_one_iteration_big_func_runtime()

When timeout < runtime of 1st iteration, one iteration should happen. TimeoutSampler won’t kill the function while it’s running over the overall timeout.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_one_iteration_big_sleep_time()

When timeout < sleep_time, TimeoutSampler object init fails on ValueError exception (as given timeout can’t be quaranteed).

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_simple_logging(caplog, capsys)

For a simple usecase, check that TimeoutSampler logging works.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_simple_usecase(timeout_cls)

Iterate over results of a simple TimeoutSampler instance and check that expected number of iterations happened and that TimeoutExpiredError was raised in the end.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_wait_for_value_negative(caplog)

Check that when wait_for_value() fails to see expected return value of given func within given timeout, exception is raised and the problem logged.

ocs_ci.utility.tests.test_utils_timeout_sampler.test_ts_wait_for_value_positive()

Check that wait_for_value() function waits for func to return given value as expected.

ocs_ci.utility.tests.test_version module

ocs_ci.utility.tests.test_version.test_compare_from_get_semantic_version()

This teest is testing that semantic version comparison works as expected and version 4.5.11 is lower than 4.11. Which in the float will not work, but in semantic versions it should be fine.

ocs_ci.utility.tests.test_version.test_compare_versions(expression, expected)

This test is suppose to test if the compare_versions returns expected values for different expressions.

ocs_ci.utility.tests.test_version.test_compare_versions_wrong_expression(expression)

This test is suppose to test if the compare_versions raises expected exception for wrong expression.

ocs_ci.utility.tests.test_version.test_get_semantic_version(product_version, only_major_minor, ignore_pre_release, expected)

This test is suppose to test if the get_semantic_version returns expected values for different combinations of paramters and different values of string version provided to that function.

ocs_ci.utility.tests.test_version.test_get_semantic_version_string_values(product_version, only_major_minor, ignore_pre_release, expected)

This test is suppose to test if the get_semantic_version returns expected values which after the sting formatting are the same as the expected. Testing all different combinations of parameters and values.

Module contents