~notmyname/swift/healthcheck_version

« back to all changes in this revision

Viewing changes to test/probe/test_container_failures.py

  • Committer: Tarmac
  • Author(s): gholt
  • Date: 2011-06-16 21:12:04 UTC
  • mfrom: (305.2.6 postcopy)
  • Revision ID: tarmac-20110616211204-s5slh4h8nt9mrd2v
You can specify X-Newest: true on GETs and HEADs to indicate you want Swift to query all backend copies and return the newest version retrieved.
Object COPY requests now always copy the newest object they can find.
Object POSTs are implemented as COPYs now by default (you can revert to previous implementation with conf object_post_as_copy = false)
Account and container GETs and HEADs now shuffle the nodes they use to balance load.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import eventlet
25
25
import sqlite3
26
26
 
27
 
from swift.common import client
 
27
from swift.common import client, direct_client
28
28
from swift.common.utils import hash_path, readconf
29
29
 
30
30
from test.probe.common import get_to_final_state, kill_pids, reset_environment
72
72
        # This okay because the first node hasn't got the update that the
73
73
        # object was deleted yet.
74
74
        self.assert_(object1 in [o['name'] for o in
75
 
                     client.get_container(self.url, self.token, container)[1]])
 
75
                     direct_client.direct_get_container(cnodes[0], cpart,
 
76
                     self.account, container)[1]])
76
77
 
77
78
        # Unfortunately, the following might pass or fail, depending on the
78
79
        # position of the account server associated with the first container
88
89
        client.put_object(self.url, self.token, container, object2, 'test')
89
90
        # First node still doesn't know object1 was deleted yet; this is okay.
90
91
        self.assert_(object1 in [o['name'] for o in
91
 
                     client.get_container(self.url, self.token, container)[1]])
 
92
                     direct_client.direct_get_container(cnodes[0], cpart,
 
93
                     self.account, container)[1]])
92
94
        # And, of course, our new object2 exists.
93
95
        self.assert_(object2 in [o['name'] for o in
94
96
                     client.get_container(self.url, self.token, container)[1]])
150
152
        # server has to indicate the container exists for the put to continue.
151
153
        client.put_object(self.url, self.token, container, object2, 'test')
152
154
        self.assert_(object1 not in [o['name'] for o in
153
 
                     client.get_container(self.url, self.token, container)[1]])
 
155
                     direct_client.direct_get_container(cnodes[0], cpart,
 
156
                     self.account, container)[1]])
154
157
        # And, of course, our new object2 exists.
155
158
        self.assert_(object2 in [o['name'] for o in
156
159
                     client.get_container(self.url, self.token, container)[1]])
201
204
        # This okay because the first node hasn't got the update that the
202
205
        # object was deleted yet.
203
206
        self.assert_(object1 in [o['name'] for o in
204
 
                     client.get_container(self.url, self.token, container)[1]])
 
207
                     direct_client.direct_get_container(cnodes[0], cpart,
 
208
                     self.account, container)[1]])
205
209
 
206
210
        # This fails because all three nodes have to indicate deletion before
207
211
        # we tell the user it worked. Since the first node 409s (it hasn't got
228
232
        client.put_object(self.url, self.token, container, object2, 'test')
229
233
        # First node still doesn't know object1 was deleted yet; this is okay.
230
234
        self.assert_(object1 in [o['name'] for o in
231
 
                     client.get_container(self.url, self.token, container)[1]])
 
235
                     direct_client.direct_get_container(cnodes[0], cpart,
 
236
                     self.account, container)[1]])
232
237
        # And, of course, our new object2 exists.
233
238
        self.assert_(object2 in [o['name'] for o in
234
239
                     client.get_container(self.url, self.token, container)[1]])
277
282
        self.assert_(container in [c['name'] for c in
278
283
                     client.get_account(self.url, self.token)[1]])
279
284
        self.assert_(object1 not in [o['name'] for o in
280
 
                     client.get_container(self.url, self.token, container)[1]])
 
285
                     direct_client.direct_get_container(cnodes[0], cpart,
 
286
                     self.account, container)[1]])
281
287
 
282
288
        # This fails because all three nodes have to indicate deletion before
283
289
        # we tell the user it worked. Since the first node 409s (it hasn't got
303
309
        # server has to indicate the container exists for the put to continue.
304
310
        client.put_object(self.url, self.token, container, object2, 'test')
305
311
        self.assert_(object1 not in [o['name'] for o in
306
 
                     client.get_container(self.url, self.token, container)[1]])
 
312
                     direct_client.direct_get_container(cnodes[0], cpart,
 
313
                     self.account, container)[1]])
307
314
        # And, of course, our new object2 exists.
308
315
        self.assert_(object2 in [o['name'] for o in
309
316
                     client.get_container(self.url, self.token, container)[1]])