From 044c919871f80e1df91ff9a40318a5afd6a2960d Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Tue, 25 Jun 2019 13:42:26 -0500 Subject: [PATCH] More tests for 404 handoff skipping Sometimes we want 404, sometimes we want 503 - it's tricky Change-Id: I30f5af07e2e1fc7cbb6bdb1c334a0a161caf0906 Related-Change-Id: I53ed04b5de20c261ddd79c98c629580472e09961 --- test/unit/proxy/controllers/test_container.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/proxy/controllers/test_container.py b/test/unit/proxy/controllers/test_container.py index fa6617eed9..993d11dbf5 100644 --- a/test/unit/proxy/controllers/test_container.py +++ b/test/unit/proxy/controllers/test_container.py @@ -348,6 +348,7 @@ class TestContainerController(TestRingBase): ([Timeout()] * (nodes + handoffs), 503), ([Timeout()] * (nodes + handoffs - 1) + [404], 503), ([Timeout()] * (nodes - 1) + [404] * (handoffs + 1), 404), + ([500] * (nodes - 1) + [404] * (handoffs + 1), 503), ([503, 200], 200), ([507, 200], 200), ] @@ -378,6 +379,16 @@ class TestContainerController(TestRingBase): resp = req.get_response(self.app) self.assertEqual(resp.status_int, 503) + def test_handoff_has_deleted_database(self): + nodes = self.app.container_ring.replicas + handoffs = self.app.request_node_count(nodes) - nodes + status = [Timeout()] * nodes + [404] * handoffs + timestamps = tuple([None] * nodes + ['1'] + [None] * (handoffs - 1)) + with mocked_http_conn(*status, timestamps=timestamps): + req = Request.blank('/v1/a/c') + resp = req.get_response(self.app) + self.assertEqual(resp.status_int, 404) + def test_response_code_for_PUT(self): PUT_TEST_CASES = [ ((201, 201, 201), 201),