From ceaaedbe4057542e374200673dd323ba64bb42eb Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Wed, 11 Mar 2015 11:22:53 +0000 Subject: [PATCH] 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 Change-Id: I3efb6c20dc1fb3e979087e8a93d04ba7e346b5b6 --- test/functional/swift_test_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/functional/swift_test_client.py b/test/functional/swift_test_client.py index 7d08e1f2ee..3c9bb0b5e2 100644 --- a/test/functional/swift_test_client.py +++ b/test/functional/swift_test_client.py @@ -460,6 +460,7 @@ class Account(Base): def delete_containers(self): for c in listing_items(self.containers): cont = self.container(c) + cont.update_metadata(hdrs={'x-versions-location': ''}) if not cont.delete_recursive(): return False