-
-
Save notmyname/5fcbcf35e6bf25515072 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tempest/api/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py | |
index cf24f66..3b968d0 100644 | |
--- a/tempest/api/object_storage/test_object_temp_url_negative.py | |
+++ b/tempest/api/object_storage/test_object_temp_url_negative.py | |
@@ -70,9 +70,6 @@ class ObjectTempUrlNegativeTest(base.BaseObjectTest): | |
self.object_client.create_object(self.container_name, | |
self.object_name, self.data) | |
- def _get_expiry_date(self, expiration_time=1000): | |
- return int(time.time() + expiration_time) | |
- | |
def _get_temp_url(self, container, object_name, method, expires, | |
key): | |
"""Create the temporary URL.""" | |
@@ -94,14 +91,18 @@ class ObjectTempUrlNegativeTest(base.BaseObjectTest): | |
@test.requires_ext(extension='tempurl', service='object') | |
def test_get_object_after_expiration_time(self): | |
- expires = self._get_expiry_date(1) | |
+ test_timeout = time.time() + 10 | |
+ expires = int(time.time() + 1.0) | |
# get a temp URL for the created object | |
url = self._get_temp_url(self.container_name, | |
self.object_name, "GET", | |
expires, self.key) | |
- # temp URL is valid for 1 seconds, let's wait 2 | |
- time.sleep(2) | |
- | |
- self.assertRaises(exceptions.Unauthorized, | |
- self.object_client.get, url) | |
+ while time.time() < test_timeout: | |
+ try: | |
+ self.object_client.get(url) | |
+ except exceptions.Unauthorized: | |
+ break | |
+ time.sleep(1) | |
+ else: | |
+ self.assertTrue(False, 'Failed to expire the object in 10 seconds') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment