This is an automated email from the ASF dual-hosted git repository.

weizhou pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new bf116762788 test: fix component test 
test_acl_sharednetwork_deployVM-impersonation.py (#9499)
bf116762788 is described below

commit bf1167627886fbb2241e0c5b6bb97e0aa7e259ed
Author: Wei Zhou <weiz...@apache.org>
AuthorDate: Wed Aug 7 18:40:50 2024 +0200

    test: fix component test test_acl_sharednetwork_deployVM-impersonation.py 
(#9499)
---
 .../test_acl_sharednetwork_deployVM-impersonation.py     | 16 ++++++++--------
 tools/marvin/marvin/cloudstackException.py               |  1 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git 
a/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py 
b/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
index 36b71defadb..84de263bdd3 100644
--- 
a/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
+++ 
b/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
@@ -1171,7 +1171,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Domain admin is NOT able to deploy a VM for user in 
ROOT domain in a shared network with scope=all")
         except Exception as e:
             self.debug("When a Domain admin user deploys a VM for ROOT user in 
a shared network with scope=all %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail("Error message validation failed when Domain admin 
is NOT able to deploy a VM for user in ROOT domain in a shared network with 
scope=all")
 
     @attr("simulator_only", tags=["advanced"], required_hardware="false")
@@ -1199,7 +1199,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Domain admin user is able to Deploy VM for a domain 
user,  but there is no access to in a shared network with scope=domain with no 
subdomain access ")
         except Exception as e:
             self.debug("When a Domain admin user  deploys a VM for a domain 
user, but there is no access to in a shared network with scope=domain with no 
subdomain access %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail(
                     "Error mesage validation failed when Domain admin user 
tries to Deploy VM for a domain user, but there is no access to in a shared 
network with scope=domain with no subdomain access ")
 
@@ -1405,7 +1405,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Domain admin is able to deploy a VM for user in ROOT 
domain in a shared network with scope=Domain and no subdomain access")
         except Exception as e:
             self.debug("When a regular user from ROOT domain deploys a VM in a 
shared network with scope=domain with no subdomain access %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail(
                     "Error message validation failed when Domain admin tries 
to deploy a VM for user in ROOT domain in a shared network with scope=Domain 
and no subdomain access")
 
@@ -1601,7 +1601,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Domain admin is able to deploy a VM for user in ROOT 
domain in a shared network with scope=Domain and subdomain access")
         except Exception as e:
             self.debug("When a user from ROOT domain deploys a VM in a shared 
network with scope=domain with subdomain access %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail(
                     "Error message validation failed when Domain admin tries 
to deploy a VM for user in ROOT domain in a shared network with scope=Domain 
and subdomain access")
 
@@ -1717,7 +1717,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Domain admin is able to deploy a VM for an regular user 
from a differnt domain in a shared network with scope=account")
         except Exception as e:
             self.debug("When a user from different domain deploys a VM in a 
shared network with scope=account %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail(
                     "Error message validation failed when Domain admin tries 
to deploy a VM for an regular user from a differnt domain in a shared network 
with scope=account")
 
@@ -1746,7 +1746,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Domain admin is able to deploy a VM for an regular user 
in ROOT domain in a shared network with scope=account")
         except Exception as e:
             self.debug("When a user from ROOT domain deploys a VM in a shared 
network with scope=account %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail("Error message validation failed when Domain admin 
tries to deploy a VM for an regular user in ROOT domain in a shared network 
with scope=account")
 
     ## Test cases relating to deploying Virtual Machine as Regular user for 
other users in shared network with scope=all
@@ -1776,7 +1776,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Regular user is allowed to deploy a VM for another user 
in the same domain in a shared network with scope=all")
         except Exception as e:
             self.debug("When a regular user deploys a VM for another user in 
the same domain in a shared network with scope=all %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail("Error message validation failed when Regular user 
tries to deploy a VM for another user in the same domain in a shared network 
with scope=all")
 
     @attr("simulator_only", tags=["advanced"], required_hardware="false")
@@ -1804,7 +1804,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
             self.fail("Regular user is allowed to deploy a VM for another user 
in the same domain in a shared network with scope=all")
         except Exception as e:
             self.debug("When a regular user deploys a VM for another user in 
the same domain in a shared network with scope=all %s" % e)
-            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+            if not CloudstackAclException.verifyMsginException(e, 
CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE):
                 self.fail("Error message validation failed when Regular user 
tries to deploy a VM for another user in the same domain in a shared network 
with scope=all")
 
     @staticmethod
diff --git a/tools/marvin/marvin/cloudstackException.py 
b/tools/marvin/marvin/cloudstackException.py
index 5a2f72d8c59..610cf15a0ba 100644
--- a/tools/marvin/marvin/cloudstackException.py
+++ b/tools/marvin/marvin/cloudstackException.py
@@ -77,6 +77,7 @@ class CloudstackAclException():
     UNABLE_TO_LIST_NETWORK_ACCOUNT = "Can't create/list resources for account"
     NO_PERMISSION_TO_ACCESS_ACCOUNT = "does not have permission to access 
resource Acct"
     NOT_AVAILABLE_IN_DOMAIN = "not available in domain"
+    NO_PERMISSION_TO_OPERATE_SOURCE = "does not have permission to operate 
with provided resource"
 
     @staticmethod
     def verifyMsginException(e,message):

Reply via email to