Many of the OpenStack components have implemented API microversions. It is important to test those microversions in Tempest or external plugins. Tempest now provides stable interfaces to support to test the API microversions. Based on the microversion range coming from the combination of both configuration and each test case, APIs request will be made with selected microversion.
This document explains the interfaces needed for microversion testing.
This class represents an API Version Request.
This class provides convenience methods for manipulation and comparison of version numbers that we need to do to implement microversions.
version_string – String representation of APIVersionRequest. Correct format is ‘X.Y’, where ‘X’ and ‘Y’ are int values. None value should be used to create Null APIVersionRequest, which is equal to 0.0
Checks API microversion in response header
Verify whether microversion is present in response header and with specified ‘api_microversion’ value.
api_microversion_header_name – Microversion header name Example- “X-OpenStack-Nova-API-Version”
api_microversion – Microversion number like “2.10”, type str.
response_header – Response header where microversion is expected to be present.
Checks API microversions range and returns whether test needs to be skip
Compare the test and configured microversion range and returns whether test microversion range is out of configured one. This method can be used to skip the test based on configured and test microversion range.
test_min_version – Test Minimum Microversion
test_max_version – Test Maximum Microversion
cfg_min_version – Configured Minimum Microversion
cfg_max_version – Configured Maximum Microversion
boolean
Compares API microversion in response header to api_microversion
.
Compare the api_microversion
value in response header if microversion
header is present in response, otherwise return false.
To make this function work for APIs which do not return microversion header in response (example compute v2.0), this function does not raise InvalidHTTPResponseHeader.
api_microversion_header_name – Microversion header name. Example: ‘Openstack-Api-Version’.
api_microversion –
Microversion number. Example:
’2.10’ for the old-style header name, ‘X-OpenStack-Nova-API-Version’
’Compute 2.10’ for the new-style header name, ‘Openstack-Api-Version’
response_header – Response header where microversion is expected to be present.
operation – The boolean operation to use to compare the
api_microversion
to the microversion in response_header
.
Can be ‘lt’, ‘eq’, ‘gt’, ‘le’, ‘ne’, ‘ge’. Default is ‘eq’. The
operation type should be based on the order of the arguments:
api_microversion
<operation> response_header
microversion.
True if the comparison is logically true, else False if the
comparison is logically false or if api_microversion_header_name
is
missing in the response_header
.
InvalidParam – If the operation is not lt, eq, gt, le, ne or ge.
Select microversion from test and configuration min version.
Compare requested microversion and return the maximum microversion out of those.
test_min_version – Test Minimum Microversion
cfg_min_version – Configured Minimum Microversion
Selected microversion string
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.