@@ -164,15 +164,10 @@ def test_document_ttl_with_positive_defaultTtl(self):
164164 'name' : 'sample document' ,
165165 'key' : 'value' }
166166
167- dummy_document_definition = { 'id' : 'dummy doc' }
168-
169167 created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
170168
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+
176171 # the created document should be gone now as it's ttl value would be same as defaultTtl value of the collection
177172 self .__AssertHTTPFailureWithStatus (
178173 404 ,
@@ -183,10 +178,7 @@ def test_document_ttl_with_positive_defaultTtl(self):
183178 document_definition ['ttl' ] = - 1
184179 created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
185180
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 )
190182
191183 # 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
192184 read_document = client .ReadDocument (created_document ['_self' ])
@@ -196,10 +188,7 @@ def test_document_ttl_with_positive_defaultTtl(self):
196188 document_definition ['ttl' ] = 2
197189 created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
198190
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 )
203192
204193 # the created document should be gone now as it's ttl value is set to 2 which overrides the collections's defaultTtl value(5)
205194 self .__AssertHTTPFailureWithStatus (
@@ -213,19 +202,13 @@ def test_document_ttl_with_positive_defaultTtl(self):
213202
214203 time .sleep (6 )
215204
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-
219205 # the created document should NOT be gone as it's ttl value is set to 8 which overrides the collections's defaultTtl value(5)
220206 read_document = client .ReadDocument (created_document ['_self' ])
221207 self .assertEqual (created_document ['id' ], read_document ['id' ])
222208
223- time .sleep (3 )
209+ time .sleep (4 )
224210
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
229212 self .__AssertHTTPFailureWithStatus (
230213 404 ,
231214 client .ReadDocument ,
@@ -246,8 +229,6 @@ def test_document_ttl_with_negative_one_defaultTtl(self):
246229 'name' : 'sample document' ,
247230 'key' : 'value' }
248231
249- dummy_document_definition = { 'id' : 'dummy doc' }
250-
251232 # the created document's ttl value would be -1 inherited from the collection's defaultTtl and this document will never expire
252233 created_document1 = client .CreateDocument (created_collection ['_self' ], document_definition )
253234
@@ -260,10 +241,7 @@ def test_document_ttl_with_negative_one_defaultTtl(self):
260241 document_definition ['ttl' ] = 2
261242 created_document3 = client .CreateDocument (created_collection ['_self' ], document_definition )
262243
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 )
267245
268246 # the created document should be gone now as it's ttl value is set to 2 which overrides the collections's defaultTtl value(-1)
269247 self .__AssertHTTPFailureWithStatus (
@@ -292,14 +270,9 @@ def test_document_ttl_with_no_defaultTtl(self):
292270 'key' : 'value' ,
293271 'ttl' : 5 }
294272
295- dummy_document_definition = { 'id' : 'dummy doc' }
296-
297273 created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
298274
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 )
303276
304277 # Created document still exists even after ttl time has passed since the TTL is disabled at collection level(no defaultTtl property defined)
305278 read_document = client .ReadDocument (created_document ['_self' ])
@@ -320,15 +293,10 @@ def test_document_ttl_misc(self):
320293 'name' : 'sample document' ,
321294 'key' : 'value' }
322295
323- dummy_document_definition = { 'id' : 'dummy doc' }
324-
325296 created_document = client .CreateDocument (created_collection ['_self' ], document_definition )
326297
327- time .sleep (9 )
298+ time .sleep (10 )
328299
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-
332300 # the created document cannot be deleted since it should already be gone now
333301 self .__AssertHTTPFailureWithStatus (
334302 404 ,
@@ -341,35 +309,24 @@ def test_document_ttl_misc(self):
341309
342310 time .sleep (3 )
343311
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-
347312 # Upsert the document after 3 secs to reset the document's ttl
348313 document_definition ['key' ] = 'value2'
349314 upserted_docment = client .UpsertDocument (created_collection ['_self' ], document_definition )
350315
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 )
355317
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
357319 read_document = client .ReadDocument (upserted_docment ['_self' ])
358320 self .assertEqual (upserted_docment ['id' ], read_document ['id' ])
359321
360322 time .sleep (3 )
361323
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
366325 self .__AssertHTTPFailureWithStatus (
367326 404 ,
368327 client .ReadDocument ,
369328 upserted_docment ['_self' ])
370329
371- client .DeleteDocument (dummy_doc ['_self' ])
372-
373330 documents = list (client .QueryDocuments (
374331 created_collection ['_self' ],
375332 {
@@ -385,10 +342,7 @@ def test_document_ttl_misc(self):
385342 document_definition ['id' ] = 'doc2'
386343 created_document = client .CreateDocument (replaced_collection ['_self' ], document_definition )
387344
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 )
392346
393347 # Created document still exists even after ttl time has passed since the TTL is disabled at collection level
394348 read_document = client .ReadDocument (created_document ['_self' ])
0 commit comments