mirror of https://github.com/apache/cloudstack.git
Refactoring StorPool's smoke tests (#7392)
* Removed the hardcoded StorPool endpoint from tests - removed the hardcoded enpoint of StorPool primary storage from tests - added the git commit information into the maven build * Convert indents to spaces * update git-commit-id-plugin version
This commit is contained in:
parent
87f218c68c
commit
da7fc72c66
|
|
@ -61,6 +61,11 @@
|
|||
<artifactId>mockito-inline</artifactId>
|
||||
<version>4.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>4.9.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
@ -78,6 +83,35 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>4.9.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>get-the-git-infos</id>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
|
||||
<prefix>git</prefix>
|
||||
<verbose>false</verbose>
|
||||
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
|
||||
<format>json</format>
|
||||
<excludeProperties>
|
||||
<excludeProperty>git.*.email</excludeProperty>
|
||||
</excludeProperties>
|
||||
<gitDescribe>
|
||||
<skip>false</skip>
|
||||
<always>false</always>
|
||||
<dirty>-dirty</dirty>
|
||||
</gitDescribe>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -78,10 +78,19 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpCloudStack(cls):
|
||||
cls.spapi = spapi.Api(host="10.2.23.248", port="81", auth="6549874687", multiCluster=True)
|
||||
config = cls.getClsConfig()
|
||||
StorPoolHelper.logger = cls
|
||||
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
|
||||
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||
testClient = super(TestMigrateVolumeToAnotherPool, cls).getClsTestClient()
|
||||
cls.apiclient = testClient.getApiClient()
|
||||
|
||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
||||
assert cls.zone is not None
|
||||
|
||||
cls._cleanup = []
|
||||
|
||||
cls.unsupportedHypervisor = False
|
||||
|
|
@ -93,14 +102,6 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase):
|
|||
cls.services = testClient.getParsedTestDataConfig()
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.apiclient)
|
||||
cls.zone = None
|
||||
zones = list_zones(cls.apiclient)
|
||||
|
||||
for z in zones:
|
||||
if z.name == cls.getClsConfig().mgtSvr[0].zone:
|
||||
cls.zone = z
|
||||
|
||||
assert cls.zone is not None
|
||||
|
||||
td = TestData()
|
||||
cls.testdata = td.testdata
|
||||
|
|
|
|||
|
|
@ -77,6 +77,13 @@ class TestStoragePool(cloudstackTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpCloudStack(cls):
|
||||
config = cls.getClsConfig()
|
||||
StorPoolHelper.logger = cls
|
||||
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
|
||||
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||
testClient = super(TestStoragePool, cls).getClsTestClient()
|
||||
|
||||
cls._cleanup = []
|
||||
|
|
@ -94,20 +101,16 @@ class TestStoragePool(cloudstackTestCase):
|
|||
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.apiclient)
|
||||
cls.zone = None
|
||||
zones = list_zones(cls.apiclient)
|
||||
|
||||
for z in zones:
|
||||
if z.name == cls.getClsConfig().mgtSvr[0].zone:
|
||||
cls.zone = z
|
||||
|
||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
||||
cls.debug(cls.zone)
|
||||
cls.debug(list_zones(cls.apiclient, name=zone.name))
|
||||
assert cls.zone is not None
|
||||
|
||||
cls.sp_template_1 = "ssd"
|
||||
storpool_primary_storage = {
|
||||
"name" : cls.sp_template_1,
|
||||
"zoneid": cls.zone.id,
|
||||
"url": "SP_API_HTTP=10.2.23.248:81;SP_AUTH_TOKEN=6549874687;SP_TEMPLATE=%s" % cls.sp_template_1,
|
||||
"url": "SP_API_HTTP=%s:%s;SP_AUTH_TOKEN=%s;SP_TEMPLATE=%s" % (zone.spEndpoint, zone.spEndpointPort, zone.spAuthToken, cls.sp_template_1),
|
||||
"scope": "zone",
|
||||
"capacitybytes": 564325555333,
|
||||
"capacityiops": 155466,
|
||||
|
|
@ -117,8 +120,6 @@ class TestStoragePool(cloudstackTestCase):
|
|||
}
|
||||
|
||||
cls.storpool_primary_storage = storpool_primary_storage
|
||||
host, port, auth = cls.getCfgFromUrl(url = storpool_primary_storage["url"])
|
||||
cls.spapi = spapi.Api(host=host, port=port, auth=auth, multiCluster=True)
|
||||
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
|
|
@ -166,7 +167,7 @@ class TestStoragePool(cloudstackTestCase):
|
|||
storpool_primary_storage2 = {
|
||||
"name" : cls.sp_template_2,
|
||||
"zoneid": cls.zone.id,
|
||||
"url": "SP_API_HTTP=10.2.23.248:81;SP_AUTH_TOKEN=6549874687;SP_TEMPLATE=%s" % cls.sp_template_2,
|
||||
"url": "SP_API_HTTP=%s:%s;SP_AUTH_TOKEN=%s;SP_TEMPLATE=%s" % (zone.spEndpoint, zone.spEndpointPort, zone.spAuthToken, cls.sp_template_2),
|
||||
"scope": "zone",
|
||||
"capacitybytes": 564325555333,
|
||||
"capacityiops": 1554,
|
||||
|
|
|
|||
|
|
@ -77,7 +77,13 @@ class TestStoragePool(cloudstackTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpCloudStack(cls):
|
||||
cls.spapi = spapi.Api(host="10.2.23.248", port="81", auth="6549874687", multiCluster=True)
|
||||
config = cls.getClsConfig()
|
||||
StorPoolHelper.logger = cls
|
||||
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
|
||||
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||
testClient = super(TestStoragePool, cls).getClsTestClient()
|
||||
cls.apiclient = testClient.getApiClient()
|
||||
cls.unsupportedHypervisor = False
|
||||
|
|
@ -91,12 +97,10 @@ class TestStoragePool(cloudstackTestCase):
|
|||
cls.services = testClient.getParsedTestDataConfig()
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.apiclient)
|
||||
cls.zone = None
|
||||
zones = list_zones(cls.apiclient)
|
||||
|
||||
for z in zones:
|
||||
if z.name == cls.getClsConfig().mgtSvr[0].zone:
|
||||
cls.zone = z
|
||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
||||
cls.debug(cls.zone)
|
||||
cls.debug(list_zones(cls.apiclient, name=zone.name))
|
||||
assert cls.zone is not None
|
||||
|
||||
assert cls.zone is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,12 @@ class TestVmSnapshot(cloudstackTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpCloudStack(cls):
|
||||
config = cls.getClsConfig()
|
||||
StorPoolHelper.logger = cls
|
||||
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
|
||||
testClient = super(TestVmSnapshot, cls).getClsTestClient()
|
||||
cls.apiclient = testClient.getApiClient()
|
||||
cls._cleanup = []
|
||||
|
|
@ -74,13 +80,9 @@ class TestVmSnapshot(cloudstackTestCase):
|
|||
cls.services = testClient.getParsedTestDataConfig()
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.apiclient)
|
||||
cls.zone = None
|
||||
zones = list_zones(cls.apiclient)
|
||||
|
||||
for z in zones:
|
||||
if z.name == cls.getClsConfig().mgtSvr[0].zone:
|
||||
cls.zone = z
|
||||
|
||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
||||
cls.debug(cls.zone)
|
||||
cls.debug(list_zones(cls.apiclient, name=zone.name))
|
||||
assert cls.zone is not None
|
||||
|
||||
cls.cluster = list_clusters(cls.apiclient)[0]
|
||||
|
|
|
|||
|
|
@ -301,6 +301,12 @@ class TestData():
|
|||
},
|
||||
}
|
||||
class StorPoolHelper():
|
||||
def setUpClass(cls):
|
||||
cls.logger = None
|
||||
|
||||
@classmethod
|
||||
def logging(cls):
|
||||
return cls.logger
|
||||
|
||||
@classmethod
|
||||
def create_template_from_snapshot(self, apiclient, services, snapshotid=None, volumeid=None):
|
||||
|
|
|
|||
Loading…
Reference in New Issue