Make functional tests tolerate pre-existing versioned container
test/functional/tests.py:TestAccount.testAccountHead relies
on the account having a known number of containers. The test
setup attempts to delete all existing containers but this fails
a container has versions (and so is not emptied, and cannot be
deleted). The tests then fails because the expected number of
containers does not match the actual.
'bin/resetswift' before running tests will obviously clear all
state but is not always convenient.
This change removes any x-versions-location header before deleting
containers during test setUp.
Steps to recreate the pre-condition for failure on master:
(based on original work by clayg)
swift post target -r '.r:*, .rlistings'
swift post source -H 'x-versions-location: target'
for i in {1..4}; do
echo "junk${i}" > junk
swift upload source junk
done
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: I3efb6c20dc1fb3e979087e8a93d04ba7e346b5b6
This commit is contained in:
committed by
Alistair Coles
parent
6a473e3d7b
commit
ceaaedbe40
@@ -460,6 +460,7 @@ class Account(Base):
|
|||||||
def delete_containers(self):
|
def delete_containers(self):
|
||||||
for c in listing_items(self.containers):
|
for c in listing_items(self.containers):
|
||||||
cont = self.container(c)
|
cont = self.container(c)
|
||||||
|
cont.update_metadata(hdrs={'x-versions-location': ''})
|
||||||
if not cont.delete_recursive():
|
if not cont.delete_recursive():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user