Fix sometimes-flaky container name functional test.

You've got two test classes: TestContainer and TestContainerUTF8. They
each try to create the same set of containers with names of varying
lengths to make sure the container-name length limit is being honored.

Also, each test class tries to clean up pre-existing data in its
setUpClass method. If TestContainerUTF8 fails to delete a contaienr
that TestContainer made, then its testContainerNameLimit method will
fail because the container PUT response has status 202 instead of 201,
which is because the container still existed from the prior test.

I've made the test consider both 201 and 202 as success. For purposes
of testing the maximum container name length, any 2xx is fine.

Change-Id: I7b343a8ed0d12537659c051ddf29226cefa78a8f
This commit is contained in:
Samuel Merritt 2017-12-21 10:43:39 -08:00
parent 5b2929d7b8
commit af2c2a6eb5

View File

@ -534,7 +534,7 @@ class TestContainer(Base):
cont = self.env.account.container('a' * l) cont = self.env.account.container('a' * l)
if l <= limit: if l <= limit:
self.assertTrue(cont.create()) self.assertTrue(cont.create())
self.assert_status(201) self.assert_status((201, 202))
else: else:
self.assertFalse(cont.create()) self.assertFalse(cont.create())
self.assert_status(400) self.assert_status(400)