You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2023/01/12 09:51:47 UTC
[cloudstack] branch main updated: tests: assess prerequisite before doing the actual test (#7040)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 08d54da938c tests: assess prerequisite before doing the actual test (#7040)
08d54da938c is described below
commit 08d54da938c390e6b7985fa4e67a71359d01c9f8
Author: dahn <da...@onecht.net>
AuthorDate: Thu Jan 12 01:51:37 2023 -0800
tests: assess prerequisite before doing the actual test (#7040)
This PR skips the tagging tests that fail due an ISO not uploading (which is not part of the functionality being tested)
relates to #7021
---
test/integration/component/test_tags.py | 68 ++++++++++++---------------------
1 file changed, 25 insertions(+), 43 deletions(-)
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index c89399b7227..2141384eaf7 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -19,6 +19,7 @@
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources, validateList
from marvin.lib.base import (Tag,
Account,
@@ -1068,21 +1069,7 @@ class TestResourceTags(cloudstackTestCase):
# 1. Create a tag on ISO using createTags API
# 2. Delete above created tag using deleteTags API
- iso = Iso.create(
- self.apiclient,
- self.services["iso"],
- account=self.account.name,
- domainid=self.account.domainid
- )
- self.debug("ISO created with ID: %s" % iso.id)
-
- list_iso_response = Iso.list(self.apiclient,
- id=iso.id)
- self.assertEqual(
- isinstance(list_iso_response, list),
- True,
- "Check list response returns a valid list"
- )
+ iso = self.create_iso()
self.debug("Creating a tag for the ISO")
tag = Tag.create(
@@ -1841,21 +1828,7 @@ class TestResourceTags(cloudstackTestCase):
)
self.cleanup.append(other_user_account)
- iso = Iso.create(
- self.apiclient,
- self.services["iso"],
- account=user_account.name,
- domainid=user_account.domainid
- )
- self.debug("ISO created with ID: %s" % iso.id)
-
- list_iso_response = Iso.list(self.apiclient,
- id=iso.id)
- self.assertEqual(
- isinstance(list_iso_response, list),
- True,
- "Check list response returns a valid list"
- )
+ iso = self.create_iso()
self.debug("Creating a tag for the ISO")
tag = Tag.create(
@@ -1935,20 +1908,8 @@ class TestResourceTags(cloudstackTestCase):
)
self.cleanup.append(user_account)
- iso = Iso.create(
- self.apiclient,
- self.services["iso"],
- account=user_account.name,
- domainid=user_account.domainid
- )
+ iso = self.create_iso()
- list_iso_response = Iso.list(self.apiclient,
- id=iso.id)
- self.assertEqual(
- isinstance(list_iso_response, list),
- True,
- "Check list response returns a valid list"
- )
Tag.create(self.apiclient,
resourceIds=iso.id,
resourceType='ISO',
@@ -3074,3 +3035,24 @@ class TestResourceTags(cloudstackTestCase):
"List tags should return empty response"
)
return
+
+ def create_iso(self):
+ try:
+ iso = Iso.create(
+ self.apiclient,
+ self.services["iso"],
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ except:
+ raise unittest.SkipTest("Cannot register ISO for tagging")
+ self.cleanup.append(iso)
+ self.debug("ISO created with ID: %s" % iso.id)
+
+ list_iso_response = Iso.list(self.apiclient,
+ id=iso.id)
+
+ if not isinstance(list_iso_response, list):
+ raise unittest.SkipTest("Registered ISO can not be found/listed for tagging")
+
+ return iso