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_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

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.

Module contents