Created
June 2, 2020 13:00
-
-
Save clayg/66f344bd4172cd0a6a2285c6546786e2 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
$ git diff | |
diff --git a/swift/container/server.py b/swift/container/server.py | |
index d6f0ea9b6..98d80f3ee 100644 | |
--- a/swift/container/server.py | |
+++ b/swift/container/server.py | |
@@ -541,7 +541,7 @@ class ContainerController(BaseStorageServer): | |
return HTTPBadRequest('Invalid body: %r' % err) | |
created = self._maybe_autocreate( | |
broker, req_timestamp, account, requested_policy_index, | |
- put_shard=True) | |
+ put_shard=False) | |
self._update_metadata(req, broker, req_timestamp, 'PUT') | |
if shard_ranges: | |
# TODO: consider writing the shard ranges into the pending | |
diff --git a/test/unit/container/test_server.py b/test/unit/container/test_server.py | |
index 23aa1687d..137ca232d 100644 | |
--- a/test/unit/container/test_server.py | |
+++ b/test/unit/container/test_server.py | |
@@ -4672,6 +4672,14 @@ class TestContainerController(unittest.TestCase): | |
resp = req.get_response(self.controller) | |
self.assertEqual(resp.status_int, 404) | |
+ req = Request.blank('/sda1/p/.shards_a/c', | |
+ environ={'REQUEST_METHOD': 'PUT'}, | |
+ headers=dict(headers), body='[]') | |
+ req.headers['x-backend-record-type'] = 'shard' | |
+ req.headers['X-Backend-Storage-Policy-Index'] = '0' | |
+ resp = req.get_response(self.controller) | |
+ self.assertEqual(resp.status_int, 201) | |
+ | |
req = Request.blank('/sda1/p/a/.c/o', | |
environ={'REQUEST_METHOD': 'PUT'}, | |
headers=dict(headers)) |
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
vagrant@saio:~$ nosetests swift/test/unit/container/test_server.py:TestContainerController | |
........................................................................F...........................................F.......... | |
====================================================================== | |
FAIL: test_PUT_shard_range_autocreates_shard_container (test.unit.container.test_server.TestContainerController) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/vagrant/swift/test/unit/container/test_server.py", line 2396, in test_PUT_shard_range_autocreates_shard_container | |
self.assertEqual(400, resp.status_int) | |
AssertionError: 400 != 404 | |
-------------------- >> begin captured stdout << --------------------- | |
test INFO: - - - [02/Jun/2020:12:58:36 +0000] "PUT /sda1/p/a/c" 404 - "-" "-" "-" 0.0003 "-" 6740 - | |
test INFO: - - - [02/Jun/2020:12:58:36 +0000] "PUT /sda1/p/.shards_a/shard_c" 404 - "-" "-" "-" 0.0002 "-" 6740 - | |
--------------------- >> end captured stdout << ---------------------- | |
====================================================================== | |
FAIL: test_put_auto_create (test.unit.container.test_server.TestContainerController) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/vagrant/swift/test/unit/container/test_server.py", line 4681, in test_put_auto_create | |
self.assertEqual(resp.status_int, 201) | |
AssertionError: 404 != 201 | |
-------------------- >> begin captured stdout << --------------------- | |
test INFO: - - - [02/Jun/2020:12:58:37 +0000] "PUT /sda1/p/a/c/o" 404 - "-" "-" "-" 0.0003 "-" 6740 - | |
test INFO: - - - [02/Jun/2020:12:58:37 +0000] "PUT /sda1/p/.a/c/o" 201 - "-" "-" "-" 0.0041 "-" 6740 - | |
test INFO: - - - [02/Jun/2020:12:58:37 +0000] "PUT /sda1/p/.shards_a/c/o" 404 - "-" "-" "-" 0.0002 "-" 6740 - | |
test INFO: - - - [02/Jun/2020:12:58:37 +0000] "PUT /sda1/p/.shards_a/c" 404 - "-" "-" "-" 0.0002 "-" 6740 0 | |
--------------------- >> end captured stdout << ---------------------- | |
---------------------------------------------------------------------- | |
Ran 127 tests in 2.627s | |
FAILED (failures=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment