[openstack-dev] Execute Tempest test with admin privileges

Joe Hakim Rahme joe.hakim.rahme at enovance.com
Mon Jul 15 15:59:23 UTC 2013


Hello,

I am trying to write a test in Tempest that would cover the behavior of
the Swift Account Quotas middleware. The use case I'm trying to cover
is that the test would create an account, put a quota on it, and try to
upload a file larger and a file smaller than the quota.

Here's what I have in my class:

class AccountQuotaTest(base.BaseObjectTest):
   @classmethod
   def setUpClass(cls):
       super(AccountQuotaTest, cls).setUpClass()
       cls.container_name = rand_name(name="TestContainer")
       cls.container_client.create_container(cls.container_name)

       # Add the account quota metadata
       size = "10"
       metadata = {"Quota-Bytes": size}
       cls.account_client.create_account_metadata(metadata=metadata)

However when I execute the tests, I get a Unauthorized exception. I
guess it makes sense, since only the admin (or any account with
ResellerAdmin role) can set this metadata.

How can I proceed so that admin sets the quota on the account?

I hope I'm clear enough, don't hesitate to ask if anything's not clear.

Joe




More information about the OpenStack-dev mailing list