@@ -164,15 +164,10 @@ def test_document_ttl_with_positive_defaultTtl(self):
164
164
'name' : 'sample document' ,
165
165
'key' : 'value' }
166
166
167
- dummy_document_definition = { 'id' : 'dummy doc' }
168
-
169
167
created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
170
168
171
- time .sleep (6 )
172
-
173
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
174
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
175
-
169
+ time .sleep (7 )
170
+
176
171
# the created document should be gone now as it's ttl value would be same as defaultTtl value of the collection
177
172
self .__AssertHTTPFailureWithStatus (
178
173
404 ,
@@ -183,10 +178,7 @@ def test_document_ttl_with_positive_defaultTtl(self):
183
178
document_definition ['ttl' ] = - 1
184
179
created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
185
180
186
- time .sleep (6 )
187
-
188
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
189
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
181
+ time .sleep (5 )
190
182
191
183
# the created document should NOT be gone as it's ttl value is set to -1(never expire) which overrides the collections's defaultTtl value
192
184
read_document = client .ReadDocument (created_document ['_self' ])
@@ -196,10 +188,7 @@ def test_document_ttl_with_positive_defaultTtl(self):
196
188
document_definition ['ttl' ] = 2
197
189
created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
198
190
199
- time .sleep (3 )
200
-
201
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
202
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
191
+ time .sleep (4 )
203
192
204
193
# the created document should be gone now as it's ttl value is set to 2 which overrides the collections's defaultTtl value(5)
205
194
self .__AssertHTTPFailureWithStatus (
@@ -213,19 +202,13 @@ def test_document_ttl_with_positive_defaultTtl(self):
213
202
214
203
time .sleep (6 )
215
204
216
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
217
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
218
-
219
205
# the created document should NOT be gone as it's ttl value is set to 8 which overrides the collections's defaultTtl value(5)
220
206
read_document = client .ReadDocument (created_document ['_self' ])
221
207
self .assertEqual (created_document ['id' ], read_document ['id' ])
222
208
223
- time .sleep (3 )
209
+ time .sleep (4 )
224
210
225
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
226
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
227
-
228
- # the created document should be gone now as we have waited for (6+3) secs which is greater than documents's ttl value of 8
211
+ # the created document should be gone now as we have waited for (6+4) secs which is greater than documents's ttl value of 8
229
212
self .__AssertHTTPFailureWithStatus (
230
213
404 ,
231
214
client .ReadDocument ,
@@ -246,8 +229,6 @@ def test_document_ttl_with_negative_one_defaultTtl(self):
246
229
'name' : 'sample document' ,
247
230
'key' : 'value' }
248
231
249
- dummy_document_definition = { 'id' : 'dummy doc' }
250
-
251
232
# the created document's ttl value would be -1 inherited from the collection's defaultTtl and this document will never expire
252
233
created_document1 = client .CreateDocument (created_collection ['_self' ], document_definition )
253
234
@@ -260,10 +241,7 @@ def test_document_ttl_with_negative_one_defaultTtl(self):
260
241
document_definition ['ttl' ] = 2
261
242
created_document3 = client .CreateDocument (created_collection ['_self' ], document_definition )
262
243
263
- time .sleep (3 )
264
-
265
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
266
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
244
+ time .sleep (4 )
267
245
268
246
# the created document should be gone now as it's ttl value is set to 2 which overrides the collections's defaultTtl value(-1)
269
247
self .__AssertHTTPFailureWithStatus (
@@ -292,14 +270,9 @@ def test_document_ttl_with_no_defaultTtl(self):
292
270
'key' : 'value' ,
293
271
'ttl' : 5 }
294
272
295
- dummy_document_definition = { 'id' : 'dummy doc' }
296
-
297
273
created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
298
274
299
- time .sleep (6 )
300
-
301
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
302
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
275
+ time .sleep (7 )
303
276
304
277
# Created document still exists even after ttl time has passed since the TTL is disabled at collection level(no defaultTtl property defined)
305
278
read_document = client .ReadDocument (created_document ['_self' ])
@@ -320,15 +293,10 @@ def test_document_ttl_misc(self):
320
293
'name' : 'sample document' ,
321
294
'key' : 'value' }
322
295
323
- dummy_document_definition = { 'id' : 'dummy doc' }
324
-
325
296
created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
326
297
327
- time .sleep (9 )
298
+ time .sleep (10 )
328
299
329
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
330
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
331
-
332
300
# the created document cannot be deleted since it should already be gone now
333
301
self .__AssertHTTPFailureWithStatus (
334
302
404 ,
@@ -341,35 +309,24 @@ def test_document_ttl_misc(self):
341
309
342
310
time .sleep (3 )
343
311
344
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
345
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
346
-
347
312
# Upsert the document after 3 secs to reset the document's ttl
348
313
document_definition ['key' ] = 'value2'
349
314
upserted_docment = client .UpsertDocument (created_collection ['_self' ], document_definition )
350
315
351
- time .sleep (6 )
352
-
353
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
354
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
316
+ time .sleep (7 )
355
317
356
- # Upserted document still exists after 9 secs from document creation time(with collection's defaultTtl set to 8) since it's ttl was reset after 3 secs by upserting it
318
+ # Upserted document still exists after 10 secs from document creation time(with collection's defaultTtl set to 8) since it's ttl was reset after 3 secs by upserting it
357
319
read_document = client .ReadDocument (upserted_docment ['_self' ])
358
320
self .assertEqual (upserted_docment ['id' ], read_document ['id' ])
359
321
360
322
time .sleep (3 )
361
323
362
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
363
- dummy_doc = client .UpsertDocument (created_collection ['_self' ], dummy_document_definition )
364
-
365
- # the upserted document should be gone now after 9 secs from the last write(upsert) of the document
324
+ # the upserted document should be gone now after 10 secs from the last write(upsert) of the document
366
325
self .__AssertHTTPFailureWithStatus (
367
326
404 ,
368
327
client .ReadDocument ,
369
328
upserted_docment ['_self' ])
370
329
371
- client .DeleteDocument (dummy_doc ['_self' ])
372
-
373
330
documents = list (client .QueryDocuments (
374
331
created_collection ['_self' ],
375
332
{
@@ -385,10 +342,7 @@ def test_document_ttl_misc(self):
385
342
document_definition ['id' ] = 'doc2'
386
343
created_document = client .CreateDocument (replaced_collection ['_self' ], document_definition )
387
344
388
- time .sleep (6 )
389
-
390
- # Call to Upsert a dummy document here is a way to update the logical timestamp of the created document
391
- dummy_doc = client .UpsertDocument (replaced_collection ['_self' ], dummy_document_definition )
345
+ time .sleep (5 )
392
346
393
347
# Created document still exists even after ttl time has passed since the TTL is disabled at collection level
394
348
read_document = client .ReadDocument (created_document ['_self' ])
0 commit comments