This work is licensed under a Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/legalcode
Implement Cinder v2 API test by sharing service client and test code with v1.
Tempest doesn’t have enough Cinder v2 api tests. We need to add more tests for it. Cinder v2 api only has some small updates, so v1 and v2 tests could share service client and test code. In this way, we don’t need to maintain many duplictate test codes.
This blueprint proposes that Cinder v1 and v2 tests share service client and test code. It includes the following changes:
v1 and v2 service client only have very little difference. Most codes should be same. So we could create a common service client and inherit it by v1 and v2.
Now each Cinder API test class inherits like:
To share API test classes, we need to create common base test class instead of BaseVolumeV1Test/BaseVolumeV2Test. The class instance can switch its behavior based on some variable which represents an API version. After applying this common class to every API test classes, the existing BaseVolumeV1Test and BaseVolumeV2Test can be removed.
We need to change v2 test classes’ inheritances to the common base test class and change v1 test classes’ inheritances to v2 test class:
In v1 test class, the variable which represents an API version should be “1”, and the variable should be “2” in v2 test class:
class SomeApiV2Test(CommonVolumeTest): _api_version = 2 [..] class SomeApiV1Test(SomeApiV2Test): _api_version = 1 [..]
Current test directory structure is
This structure is not understandable, and it is better to move v1 API test files to some directory which shows v1’s one clearly.
This blueprint proposes to change the structure to
The test cases which can share the code between v1 and v2 will be stored in “tempest/api/volume/”. For specific test cases which don’t have shared code, the inheritance model from (3) won’t work. The hierarchy would be:
and these test files would be stored in: