Merge pull request #1534 from coreos-inc/flakey-test

Fix flaky tests
This commit is contained in:
josephschorr 2016-06-13 16:12:15 -04:00 committed by GitHub
commit 9263aad2ac

View file

@ -314,6 +314,9 @@ class BaseRegistryMixin(object):
response = self.session.request(method, self.get_server_url() + url, headers=headers, data=data,
auth=auth_tuple, params=params)
if expected_code is None:
return response
if response.status_code != expected_code:
print response.text
@ -1503,10 +1506,20 @@ class ACIConversionTests(RegistryTestCaseMixin, V1RegistryPushMixin, LiveServerT
return tar, response.content
def get_converted_signature(self):
# Give time for the signature to be written before continuing.
time.sleep(2)
response = self.conduct('GET', '/c1/aci/localhost:5000/devtable/newrepo/latest/aci.asc/linux/amd64/', auth='sig')
return response.content
counter = 0
# Give time for the signature to be written before continuing. As we don't exactly know when
# this is (based on CPU conditions when the test is being run), we try a backoff and sleep
# approach.
while counter < 5:
response = self.conduct('GET', '/c1/aci/localhost:5000/devtable/newrepo/latest/aci.asc/linux/amd64/', auth='sig', expected_code=None)
if response.status_code == 202 or response.status_code == 404:
counter += 1
time.sleep(counter * 2)
else:
return response.content
self.fail('Signature was never created')
def _verify_signature(self, signature, converted):
sig_bytes = StringIO(signature)