Skip to content

Refactoring smoke tests #11107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions test/integration/plugins/storpool/MigrateVolumeToStorPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def setUpCloudStack(cls):
zone = config.zones[0]
assert zone is not None

td = TestData()
cls.testdata = td.testdata
cls.helper = StorPoolHelper()
sp_pools = cls.helper.get_pool(zone)
assert sp_pools 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()
Expand All @@ -103,11 +109,8 @@ def setUpCloudStack(cls):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)

td = TestData()
cls.testdata = td.testdata
cls.helper = StorPoolHelper()
storpool_primary_storage = cls.testdata[TestData.primaryStorage]
cls.template_name = storpool_primary_storage.get("name")
storpool_primary_storage = sp_pools[0]
cls.template_name = storpool_primary_storage["name"]
storpool_service_offerings = cls.testdata[TestData.serviceOffering]

nfs_service_offerings = cls.testdata[TestData.serviceOfferingsPrimary]
Expand Down Expand Up @@ -283,12 +286,6 @@ def tearDownClass(cls):
@classmethod
def cleanUpCloudStack(cls):
try:
if cls.nfs_storage_pool.state is not "Maintenance":
cls.nfs_storage_pool = StoragePool.enableMaintenance(cls.apiclient, cls.nfs_storage_pool.id)

if cls.ceph_storage_pool.state is not "Maintenance":
cls.ceph_storage_pool = StoragePool.enableMaintenance(cls.apiclient, cls.ceph_storage_pool.id)

cls.storage_pool = StoragePool.update(cls.apiclient,
id=cls.storage_pool.id,
tags = ["ssd"])
Expand Down
135 changes: 38 additions & 97 deletions test/integration/plugins/storpool/TestEncryptedVolumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,18 @@ def setUpCloudStack(cls):

zone = config.zones[0]
assert zone is not None
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]

cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
storage_pools = zone.primaryStorages
sp_pools = []
for storage in storage_pools:
if storage['provider'] and "StorPool" in storage['provider']:
sp_pools.append(storage)

if len(sp_pools) < 2:
cls.debug("Cannot perform the tests because there aren't the required count of StorPool storage pools %s" % sp_pools)
return

cls.zone = list_zones(cls.apiclient, name=zone.name)[0]

cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
cls.helper = StorPoolHelper()
Expand All @@ -118,124 +127,56 @@ def setUpCloudStack(cls):
td = TestData()
cls.testdata = td.testdata

cls.sp_template_1 = "ssd"
storpool_primary_storage = {
"name": cls.sp_template_1,
"zoneid": cls.zone.id,
"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,
"hypervisor": "kvm",
"provider": "StorPool",
"tags": cls.sp_template_1
}

cls.storpool_primary_storage = storpool_primary_storage
storpool_primary_storage = sp_pools[0]
cls.template_name = storpool_primary_storage["name"]

storage_pool = list_storage_pools(
cls.apiclient,
name=storpool_primary_storage["name"]
)

name=cls.template_name
)
if storage_pool is None:
newTemplate = sptypes.VolumeTemplateCreateDesc(name=storpool_primary_storage["name"], placeAll="virtual",
placeTail="virtual", placeHead="virtual", replication=1)
template_on_local = cls.spapi.volumeTemplateCreate(newTemplate)

storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
else:
storage_pool = storage_pool[0]
cls.primary_storage = storage_pool
cls.storage_pool = storage_pool
cls.helper.updateStoragePoolTags(cls.apiclient, cls.storage_pool.id, cls.testdata[TestData.sp_template_1]["tags"])

storpool_service_offerings_ssd = {
"name": "ssd-encrypted",
"displaytext": "SP_CO_2 (Min IOPS = 10,000; Max IOPS = 15,000)",
"cpunumber": 1,
"cpuspeed": 500,
"memory": 512,
"storagetype": "shared",
"customizediops": False,
"hypervisorsnapshotreserve": 200,
"encryptroot": True,
"tags": cls.sp_template_1
}
cls.debug(pprint.pformat(storage_pool))

service_offerings_ssd = list_service_offering(
cls.apiclient,
name=storpool_service_offerings_ssd["name"]
)
cls.primary_storage = storage_pool

if service_offerings_ssd is None:
service_offerings_ssd = ServiceOffering.create(cls.apiclient, storpool_service_offerings_ssd, encryptroot=True)
else:
service_offerings_ssd = service_offerings_ssd[0]
storpool_primary_storage = sp_pools[1]
cls.template_name = storpool_primary_storage["name"]

cls.service_offering = service_offerings_ssd
cls.debug(pprint.pformat(cls.service_offering))

cls.sp_template_2 = "ssd2"

storpool_primary_storage2 = {
"name": cls.sp_template_2,
"zoneid": cls.zone.id,
"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,
"hypervisor": "kvm",
"provider": "StorPool",
"tags": cls.sp_template_2
}

cls.storpool_primary_storage2 = storpool_primary_storage2
storage_pool = list_storage_pools(
cls.apiclient,
name=storpool_primary_storage2["name"]
)

name=cls.template_name
)
if storage_pool is None:
newTemplate = sptypes.VolumeTemplateCreateDesc(name=storpool_primary_storage2["name"], placeAll="virtual",
placeTail="virtual", placeHead="virtual", replication=1)
template_on_local = cls.spapi.volumeTemplateCreate(newTemplate)
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage2)

storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
else:
storage_pool = storage_pool[0]
cls.primary_storage2 = storage_pool
cls.storage_pool = storage_pool
cls.helper.updateStoragePoolTags(cls.apiclient, cls.storage_pool.id, cls.testdata[TestData.sp_template_2]["tags"])

storpool_service_offerings_ssd2 = {
"name": "ssd2-encrypted",
"displaytext": "SP_CO_2",
"cpunumber": 1,
"cpuspeed": 500,
"memory": 512,
"storagetype": "shared",
"customizediops": False,
"encryptroot": True,
"tags": cls.sp_template_2
}

service_offerings_ssd2 = list_service_offering(
cls.apiclient,
name=storpool_service_offerings_ssd2["name"]
)
cls.debug(pprint.pformat(storage_pool))

if service_offerings_ssd2 is None:
service_offerings_ssd2 = ServiceOffering.create(cls.apiclient, storpool_service_offerings_ssd2, encryptroot=True)
else:
service_offerings_ssd2 = service_offerings_ssd2[0]
cls.primary_storage2 = storage_pool

cls.service_offering2 = service_offerings_ssd2
storpool_service_offerings_ssd = cls.testdata[TestData.serviceOfferingEncrypted]

cls.disk_offerings_ssd2_encrypted = list_disk_offering(
service_offerings_ssd = list_service_offering(
cls.apiclient,
name=cls.testdata[TestData.diskOfferingEncrypted2]["name"]
name=storpool_service_offerings_ssd["name"]
)
if cls.disk_offerings_ssd2_encrypted is None:
cls.disk_offerings_ssd2_encrypted = DiskOffering.create(cls.apiclient, cls.testdata[TestData.diskOfferingEncrypted2], encrypt=True)

if service_offerings_ssd is None:
service_offerings_ssd = ServiceOffering.create(cls.apiclient, storpool_service_offerings_ssd, encryptroot=True)
else:
cls.disk_offerings_ssd2_encrypted = cls.disk_offerings_ssd2_encrypted[0]
service_offerings_ssd = service_offerings_ssd[0]

cls.service_offering = service_offerings_ssd
cls.debug(pprint.pformat(cls.service_offering))

cls.disk_offering_ssd_encrypted = list_disk_offering(
cls.apiclient,
Expand Down
Loading
Loading