From 45415ed80672b14007d11a72f72ad8510d1d9e70 Mon Sep 17 00:00:00 2001 From: Slavka Peleva Date: Sun, 2 Apr 2023 14:58:54 +0300 Subject: [PATCH 1/3] 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 --- plugins/storage/volume/storpool/pom.xml | 34 +++++++++++++++++++ .../storpool/MigrateVolumeToStorPool.py | 19 ++++++----- .../plugins/storpool/TestStorPoolVolumes.py | 23 +++++++------ .../plugins/storpool/TestTagsOnStorPool.py | 18 ++++++---- .../plugins/storpool/TestVmSnapshots.py | 16 +++++---- test/integration/plugins/storpool/sp_util.py | 6 ++++ 6 files changed, 82 insertions(+), 34 deletions(-) diff --git a/plugins/storage/volume/storpool/pom.xml b/plugins/storage/volume/storpool/pom.xml index 418643079d79..ef57fdb604d5 100644 --- a/plugins/storage/volume/storpool/pom.xml +++ b/plugins/storage/volume/storpool/pom.xml @@ -61,6 +61,11 @@ mockito-inline 4.7.0 + + pl.project13.maven + git-commit-id-plugin + 2.2.6 + @@ -78,6 +83,35 @@ + + pl.project13.maven + git-commit-id-plugin + 2.2.6 + + + get-the-git-infos + + revision + + + + + ${project.basedir}/.git + git + false + true + ${project.build.outputDirectory}/git.properties + json + + git.*.email + + + false + false + -dirty + + + diff --git a/test/integration/plugins/storpool/MigrateVolumeToStorPool.py b/test/integration/plugins/storpool/MigrateVolumeToStorPool.py index a7f87d9fa87e..5babdca094e8 100644 --- a/test/integration/plugins/storpool/MigrateVolumeToStorPool.py +++ b/test/integration/plugins/storpool/MigrateVolumeToStorPool.py @@ -78,10 +78,19 @@ def setUpClass(cls): @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 @@ def setUpCloudStack(cls): 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 diff --git a/test/integration/plugins/storpool/TestStorPoolVolumes.py b/test/integration/plugins/storpool/TestStorPoolVolumes.py index 68e2a7054406..640a2f9d2bc5 100644 --- a/test/integration/plugins/storpool/TestStorPoolVolumes.py +++ b/test/integration/plugins/storpool/TestStorPoolVolumes.py @@ -77,6 +77,13 @@ def setUpClass(cls): @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 @@ def setUpCloudStack(cls): # 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 @@ def setUpCloudStack(cls): } 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 @@ def setUpCloudStack(cls): 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, diff --git a/test/integration/plugins/storpool/TestTagsOnStorPool.py b/test/integration/plugins/storpool/TestTagsOnStorPool.py index 554e905d2f3d..6d13e2081d9b 100644 --- a/test/integration/plugins/storpool/TestTagsOnStorPool.py +++ b/test/integration/plugins/storpool/TestTagsOnStorPool.py @@ -77,7 +77,13 @@ def setUpClass(cls): @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 @@ def setUpCloudStack(cls): 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 diff --git a/test/integration/plugins/storpool/TestVmSnapshots.py b/test/integration/plugins/storpool/TestVmSnapshots.py index b1daa93edad5..ab35c076b4e7 100644 --- a/test/integration/plugins/storpool/TestVmSnapshots.py +++ b/test/integration/plugins/storpool/TestVmSnapshots.py @@ -60,6 +60,12 @@ def setUpClass(cls): @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 @@ def setUpCloudStack(cls): 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] diff --git a/test/integration/plugins/storpool/sp_util.py b/test/integration/plugins/storpool/sp_util.py index 6517841354a9..569aa4a25390 100644 --- a/test/integration/plugins/storpool/sp_util.py +++ b/test/integration/plugins/storpool/sp_util.py @@ -301,6 +301,12 @@ def __init__(self): }, } 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): From c0a8287333fd5bfeeb60e72a1348081096ee7e59 Mon Sep 17 00:00:00 2001 From: Slavka Peleva Date: Tue, 4 Apr 2023 10:20:34 +0300 Subject: [PATCH 2/3] Convert indents to spaces --- plugins/storage/volume/storpool/pom.xml | 68 ++++++++++++------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/plugins/storage/volume/storpool/pom.xml b/plugins/storage/volume/storpool/pom.xml index ef57fdb604d5..842cdd51d33a 100644 --- a/plugins/storage/volume/storpool/pom.xml +++ b/plugins/storage/volume/storpool/pom.xml @@ -61,11 +61,11 @@ mockito-inline 4.7.0 - - pl.project13.maven - git-commit-id-plugin - 2.2.6 - + + pl.project13.maven + git-commit-id-plugin + 2.2.6 + @@ -83,35 +83,35 @@ - - pl.project13.maven - git-commit-id-plugin - 2.2.6 - - - get-the-git-infos - - revision - - - - - ${project.basedir}/.git - git - false - true - ${project.build.outputDirectory}/git.properties - json - - git.*.email - - - false - false - -dirty - - - + + pl.project13.maven + git-commit-id-plugin + 2.2.6 + + + get-the-git-infos + + revision + + + + + ${project.basedir}/.git + git + false + true + ${project.build.outputDirectory}/git.properties + json + + git.*.email + + + false + false + -dirty + + + From 45c0ba937c6d27a597b6e3f74175e6dbed3ee707 Mon Sep 17 00:00:00 2001 From: Slavka Peleva Date: Mon, 31 Jul 2023 09:52:28 +0300 Subject: [PATCH 3/3] update git-commit-id-plugin version --- plugins/storage/volume/storpool/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/storage/volume/storpool/pom.xml b/plugins/storage/volume/storpool/pom.xml index 842cdd51d33a..ee4c5cfb6f0b 100644 --- a/plugins/storage/volume/storpool/pom.xml +++ b/plugins/storage/volume/storpool/pom.xml @@ -64,7 +64,7 @@ pl.project13.maven git-commit-id-plugin - 2.2.6 + 4.9.10 @@ -86,7 +86,7 @@ pl.project13.maven git-commit-id-plugin - 2.2.6 + 4.9.10 get-the-git-infos