octavia_tempest_plugin.tests package

Subpackages

Submodules

octavia_tempest_plugin.tests.RBAC_tests module

class RBACTestsMixin(*args, **kwargs)[source]

Bases: tempest.test.BaseTestCase

check_create_RBAC_enforcement(client_str, method_str, expected_allowed, status_method=None, obj_id=None, *args, **kwargs)[source]

Test an API create call RBAC enforcement.

Parameters
  • client_str – The service client to use for the test, without the credential. Example: ‘AmphoraClient’

  • method_str – The method on the client to call for the test. Example: ‘list_amphorae’

  • expected_allowed – The list of credentials expected to be allowed. Example: [‘os_roles_lb_member’].

  • status_method – The service client method that will provide the object status for a status change waiter.

  • obj_id – The ID of the object to check for the expected status update.

  • args – Any positional parameters needed by the method.

  • kwargs – Any named parameters needed by the method.

Raises
  • AssertionError – Raised if the RBAC tests fail.

  • Forbidden – Raised if a credential that should have access does not and is denied.

  • InvalidScope – Raised if a credential that should have the correct scope for access is denied.

Returns

None on success

check_delete_RBAC_enforcement(client_str, method_str, expected_allowed, status_method=None, obj_id=None, *args, **kwargs)[source]

Test an API delete call RBAC enforcement.

Parameters
  • client_str – The service client to use for the test, without the credential. Example: ‘AmphoraClient’

  • method_str – The method on the client to call for the test. Example: ‘list_amphorae’

  • expected_allowed – The list of credentials expected to be allowed. Example: [‘os_roles_lb_member’].

  • status_method – The service client method that will provide the object status for a status change waiter.

  • obj_id – The ID of the object to check for the expected status update.

  • args – Any positional parameters needed by the method.

  • kwargs – Any named parameters needed by the method.

Raises
  • AssertionError – Raised if the RBAC tests fail.

  • Forbidden – Raised if a credential that should have access does not and is denied.

  • InvalidScope – Raised if a credential that should have the correct scope for access is denied.

Returns

None on success

check_list_IDs_RBAC_enforcement(client_str, method_str, expected_allowed, expected_ids, *args, **kwargs)[source]

Test an API list call RBAC enforcement result contains IDs.

List APIs will return the object list for the project associated with the token used to access the API. This means most credentials will have access, but will get differing results.

This test will query the list API using a list of credentials and will validate that the expected object Ids in included in the results.

Parameters
  • client_str – The service client to use for the test, without the credential. Example: ‘AmphoraClient’

  • method_str – The method on the client to call for the test. Example: ‘list_amphorae’

  • expected_allowed – The list of credentials expected to be allowed. Example: [‘os_roles_lb_member’].

  • expected_ids – The list of object IDs to validate are included in the returned list from the API.

  • args – Any positional parameters needed by the method.

  • kwargs – Any named parameters needed by the method.

Raises
  • AssertionError – Raised if the RBAC tests fail.

  • Forbidden – Raised if a credential that should have access does not and is denied.

  • InvalidScope – Raised if a credential that should have the correct scope for access is denied.

Returns

None on success

check_list_RBAC_enforcement(client_str, method_str, expected_allowed, *args, **kwargs)[source]

Test an API list call RBAC enforcement.

Parameters
  • client_str – The service client to use for the test, without the credential. Example: ‘AmphoraClient’

  • method_str – The method on the client to call for the test. Example: ‘list_amphorae’

  • expected_allowed – The list of credentials expected to be allowed. Example: [‘os_roles_lb_member’].

  • args – Any positional parameters needed by the method.

  • kwargs – Any named parameters needed by the method.

Raises
  • AssertionError – Raised if the RBAC tests fail.

  • Forbidden – Raised if a credential that should have access does not and is denied.

  • InvalidScope – Raised if a credential that should have the correct scope for access is denied.

Returns

None on success

check_list_RBAC_enforcement_count(client_str, method_str, expected_allowed, expected_count, *args, **kwargs)[source]

Test an API list call RBAC enforcement result count.

List APIs will return the object list for the project associated with the token used to access the API. This means most credentials will have access, but will get differing results.

This test will query the list API using a list of credentials and will validate that only the expected count of results are returned.

Parameters
  • client_str – The service client to use for the test, without the credential. Example: ‘AmphoraClient’

  • method_str – The method on the client to call for the test. Example: ‘list_amphorae’

  • expected_allowed – The list of credentials expected to be allowed. Example: [‘os_roles_lb_member’].

  • expected_count – The number of results expected in the list returned from the API.

  • args – Any positional parameters needed by the method.

  • kwargs – Any named parameters needed by the method.

Raises
  • AssertionError – Raised if the RBAC tests fail.

  • Forbidden – Raised if a credential that should have access does not and is denied.

  • InvalidScope – Raised if a credential that should have the correct scope for access is denied.

Returns

None on success

check_show_RBAC_enforcement(client_str, method_str, expected_allowed, *args, **kwargs)[source]

Test an API show call RBAC enforcement.

Parameters
  • client_str – The service client to use for the test, without the credential. Example: ‘AmphoraClient’

  • method_str – The method on the client to call for the test. Example: ‘list_amphorae’

  • expected_allowed – The list of credentials expected to be allowed. Example: [‘os_roles_lb_member’].

  • args – Any positional parameters needed by the method.

  • kwargs – Any named parameters needed by the method.

Raises
  • AssertionError – Raised if the RBAC tests fail.

  • Forbidden – Raised if a credential that should have access does not and is denied.

  • InvalidScope – Raised if a credential that should have the correct scope for access is denied.

Returns

None on success

check_update_RBAC_enforcement(client_str, method_str, expected_allowed, status_method=None, obj_id=None, *args, **kwargs)[source]

Test an API update call RBAC enforcement.

Parameters
  • client_str – The service client to use for the test, without the credential. Example: ‘AmphoraClient’

  • method_str – The method on the client to call for the test. Example: ‘list_amphorae’

  • expected_allowed – The list of credentials expected to be allowed. Example: [‘os_roles_lb_member’].

  • status_method – The service client method that will provide the object status for a status change waiter.

  • obj_id – The ID of the object to check for the expected status update.

  • args – Any positional parameters needed by the method.

  • kwargs – Any named parameters needed by the method.

Raises
  • AssertionError – Raised if the RBAC tests fail.

  • Forbidden – Raised if a credential that should have access does not and is denied.

  • InvalidScope – Raised if a credential that should have the correct scope for access is denied.

Returns

None on success

octavia_tempest_plugin.tests.test_base module

octavia_tempest_plugin.tests.validators module

octavia_tempest_plugin.tests.waiters module

wait_for_deleted_status_or_not_found(show_client, id, status_key, check_interval, check_timeout, root_tag=None, **kwargs)[source]

Waits for an object to reach a DELETED status or be not found (404).

Parameters
  • show_client – The tempest service client show method. Ex. cls.os_primary.servers_client.show_server

  • id – The id of the object to query.

  • status_key – The key of the status field in the response. Ex. provisioning_status

Check_interval

How often to check the status, in seconds.

Check_timeout

The maximum time, in seconds, to check the status.

Root_tag

The root tag on the response to remove, if any.

Raises
  • CommandFailed – Raised if the object goes into ERROR and ERROR was not the desired status.

  • TimeoutException – The object did not achieve the status or ERROR in the check_timeout period.

Returns

None

wait_for_not_found(delete_func, show_func, *args, **kwargs)[source]

Call the delete function, then wait for it to be ‘NotFound’

Parameters
  • delete_func – The delete function to call.

  • show_func – The show function to call looking for ‘NotFound’.

  • ID – The ID of the object to delete/show.

Raises

TimeoutException – The object did not achieve the status or ERROR in the check_timeout period.

Returns

None

wait_for_spare_amps(list_func, check_interval, check_timeout)[source]

Waits for amphorae in spare pool.

Parameters

list_func – The tempest service client amphora list method. Ex. cls.os_admin.amphora_client.list_amphorae

Check_interval

How often to check the status, in seconds.

Check_timeout

The maximum time, in seconds, to check the status.

Raises

TimeoutException – No amphora available in spare pool in the check_timeout period.

Returns

A list of amphorae in spare pool.

wait_for_status(show_client, id, status_key, status, check_interval, check_timeout, root_tag=None, error_ok=False, **kwargs)[source]

Waits for an object to reach a specific status.

Parameters
  • show_client – The tempest service client show method. Ex. cls.os_primary.servers_client.show_server

  • id – The id of the object to query.

  • status_key – The key of the status field in the response. Ex. provisioning_status

  • status – The status to wait for. Ex. “ACTIVE”

Check_interval

How often to check the status, in seconds.

Check_timeout

The maximum time, in seconds, to check the status.

Root_tag

The root tag on the response to remove, if any.

Error_ok

When true, ERROR status will not raise an exception.

Raises
  • CommandFailed – Raised if the object goes into ERROR and ERROR was not the desired status.

  • TimeoutException – The object did not achieve the status or ERROR in the check_timeout period.

Returns

The object details from the show client.

wait_until_true(func, timeout=60, sleep=1, **kwargs)[source]

Wait until callable predicate is evaluated as True

Parameters
  • func – Callable deciding whether waiting should continue.

  • timeout – Timeout in seconds how long should function wait.

  • sleep – Polling interval for results in seconds.

Module contents