|
113 | 113 | ################################################################################
|
114 | 114 |
|
115 | 115 | context "handling exports:" do
|
116 |
| - before do |
| 116 | + before(:all) do |
117 | 117 | @cn = "users"
|
118 | 118 | ArangoDB.drop_collection(@cn)
|
119 | 119 | @cid = ArangoDB.create_collection(@cn, false)
|
|
123 | 123 | }
|
124 | 124 | end
|
125 | 125 |
|
126 |
| - after do |
| 126 | + after(:all) do |
127 | 127 | ArangoDB.drop_collection(@cn)
|
128 | 128 | end
|
129 | 129 |
|
|
361 | 361 | doc.parsed_response['id'].should be_nil
|
362 | 362 | end
|
363 | 363 |
|
364 |
| - it "creates a cursor that will expire" do |
365 |
| - cmd = api + "?collection=#{@cn}" |
366 |
| - body = "{ \"count\" : true, \"batchSize\" : 1, \"ttl\" : 4, \"flush\" : true }" |
367 |
| - doc = ArangoDB.log_post("#{prefix}-create-ttl", cmd, :body => body) |
368 |
| - |
369 |
| - doc.code.should eq(201) |
370 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
371 |
| - doc.parsed_response['error'].should eq(false) |
372 |
| - doc.parsed_response['code'].should eq(201) |
373 |
| - doc.parsed_response['id'].should be_kind_of(String) |
374 |
| - doc.parsed_response['id'].should match(@reId) |
375 |
| - doc.parsed_response['hasMore'].should eq(true) |
376 |
| - doc.parsed_response['count'].should eq(10) |
377 |
| - doc.parsed_response['result'].length.should eq(1) |
378 |
| - |
379 |
| - sleep 1 |
380 |
| - id = doc.parsed_response['id'] |
381 |
| - |
382 |
| - cmd = api + "/#{id}" |
383 |
| - doc = ArangoDB.log_put("#{prefix}-create-ttl", cmd) |
384 |
| - |
385 |
| - doc.code.should eq(200) |
386 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
387 |
| - doc.parsed_response['error'].should eq(false) |
388 |
| - doc.parsed_response['code'].should eq(200) |
389 |
| - doc.parsed_response['id'].should be_kind_of(String) |
390 |
| - doc.parsed_response['id'].should match(@reId) |
391 |
| - doc.parsed_response['id'].should eq(id) |
392 |
| - doc.parsed_response['hasMore'].should eq(true) |
393 |
| - doc.parsed_response['count'].should eq(10) |
394 |
| - doc.parsed_response['result'].length.should eq(1) |
395 |
| - |
396 |
| - sleep 1 |
397 |
| - |
398 |
| - doc = ArangoDB.log_put("#{prefix}-create-ttl", cmd) |
399 |
| - |
400 |
| - doc.code.should eq(200) |
401 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
402 |
| - doc.parsed_response['error'].should eq(false) |
403 |
| - doc.parsed_response['code'].should eq(200) |
404 |
| - doc.parsed_response['id'].should eq(id) |
405 |
| - doc.parsed_response['hasMore'].should eq(true) |
406 |
| - doc.parsed_response['count'].should eq(10) |
407 |
| - doc.parsed_response['result'].length.should eq(1) |
408 |
| - |
409 |
| - # after this, the cursor might expire eventually |
410 |
| - # the problem is that we cannot exactly determine the point in time |
411 |
| - # when it really vanishes, as this depends on thread scheduling, state |
412 |
| - # of the cleanup thread etc. |
413 |
| - |
414 |
| - # sleep 10 # this should delete the cursor on the serv
F438
er |
415 |
| - # doc = ArangoDB.log_put("#{prefix}-create-ttl", cmd) |
416 |
| - # doc.code.should eq(404) |
417 |
| - # doc.headers['content-type'].should eq("application/json; charset=utf-8") |
418 |
| - # doc.parsed_response['error'].should eq(true) |
419 |
| - # doc.parsed_response['errorNum'].should eq(1600) |
420 |
| - # doc.parsed_response['code'].should eq(404) |
421 |
| - end |
422 |
| - |
423 |
| - it "creates a cursor that will not expire" do |
424 |
| - cmd = api + "?collection=#{@cn}" |
425 |
| - body = "{ \"count\" : true, \"batchSize\" : 1, \"ttl\" : 60, \"flush\" : true }" |
426 |
| - doc = ArangoDB.log_post("#{prefix}-create-ttl", cmd, :body => body) |
427 |
| - |
428 |
| - doc.code.should eq(201) |
429 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
430 |
| - doc.parsed_response['error'].should eq(false) |
431 |
| - doc.parsed_response['code'].should eq(201) |
432 |
| - doc.parsed_response['id'].should be_kind_of(String) |
433 |
| - doc.parsed_response['id'].should match(@reId) |
434 |
| - doc.parsed_response['hasMore'].should eq(true) |
435 |
| - doc.parsed_response['count'].should eq(10) |
436 |
| - doc.parsed_response['result'].length.should eq(1) |
437 |
| - |
438 |
| - sleep 1 |
439 |
| - id = doc.parsed_response['id'] |
440 |
| - |
441 |
| - cmd = api + "/#{id}" |
442 |
| - doc = ArangoDB.log_put("#{prefix}-create-ttl", cmd) |
443 |
| - |
444 |
| - doc.code.should eq(200) |
445 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
446 |
| - doc.parsed_response['error'].should eq(false) |
447 |
| - doc.parsed_response['code'].should eq(200) |
448 |
| - doc.parsed_response['id'].should be_kind_of(String) |
449 |
| - doc.parsed_response['id'].should match(@reId) |
450 |
| - doc.parsed_response['id'].should eq(id) |
451 |
| - doc.parsed_response['hasMore'].should eq(true) |
452 |
| - doc.parsed_response['count'].should
10000
eq(10) |
453 |
| - doc.parsed_response['result'].length.should eq(1) |
454 |
| - |
455 |
| - sleep 1 |
456 |
| - |
457 |
| - doc = ArangoDB.log_put("#{prefix}-create-ttl", cmd) |
458 |
| - |
459 |
| - doc.code.should eq(200) |
460 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
461 |
| - doc.parsed_response['error'].should eq(false) |
462 |
| - doc.parsed_response['code'].should eq(200) |
463 |
| - doc.parsed_response['id'].should eq(id) |
464 |
| - doc.parsed_response['hasMore'].should eq(true) |
465 |
| - doc.parsed_response['count'].should eq(10) |
466 |
| - doc.parsed_response['result'].length.should eq(1) |
467 |
| - |
468 |
| - sleep 5 # this should not delete the cursor on the server |
469 |
| - |
470 |
| - doc = ArangoDB.log_put("#{prefix}-create-ttl", cmd) |
471 |
| - |
472 |
| - doc.code.should eq(200) |
473 |
| - doc.parsed_response['error'].should eq(false) |
474 |
| - doc.parsed_response['code'].should eq(200) |
475 |
| - doc.parsed_response['id'].should eq(id) |
476 |
| - doc.parsed_response['hasMore'].should eq(true) |
477 |
| - doc.parsed_response['count'].should eq(10) |
478 |
| - doc.parsed_response['result'].length.should eq(1) |
479 |
| - |
480 |
| - # must clean up. otherwise we'll have to wait 60 seconds! |
481 |
| - doc = ArangoDB.log_delete("#{prefix}-create-ttl", cmd) |
482 |
| - end |
483 | 364 | end
|
484 | 365 |
|
485 | 366 | ################################################################################
|
|
566 | 447 | doc.parsed_response['errorNum'].should eq(1600)
|
567 | 448 | doc.parsed_response['code'].should eq(404)
|
568 | 449 | end
|
569 |
| - |
570 |
| - it "consumes a cursor, while compaction is running" do |
571 |
| - cmd = api + "?collection=#{@cn}" |
572 |
| - body = "{ \"count\" : true, \"batchSize\" : 700, \"flush\" : true }" |
573 |
| - doc = ArangoDB.log_post("#{prefix}-limit-return", cmd, :body => body) |
574 |
| - |
575 |
| - doc.code.should eq(201) |
576 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
577 |
| - doc.parsed_response['error'].should eq(false) |
578 |
| - doc.parsed_response['code'].should eq(201) |
579 |
| - doc.parsed_response['id'].should be_kind_of(String) |
580 |
| - doc.parsed_response['id'].should match(@reId) |
581 |
| - doc.parsed_response['hasMore'].should eq(true) |
582 |
| - doc.parsed_response['count'].should eq(2000) |
583 |
| - doc.parsed_response['result'].length.should eq(700) |
584 |
| - |
585 |
| - id = doc.parsed_response['id'] |
586 |
| - |
587 |
| - # truncating the collection should not affect the results in the cursor |
588 |
| - cmd = "/_api/collection/#{@cn}/truncate" |
589 |
| - doc = ArangoDB.log_put("#{prefix}-return-cont", cmd) |
590 |
| - |
591 |
| - # flush wal |
592 |
| - cmd = "/_admin/wal/flush?waitForSync=true&waitForCollector=true" |
593 |
| - doc = ArangoDB.log_put("#{prefix}-return-cont", cmd) |
594 |
| - |
595 |
| - # rotate the journal |
596 |
| - cmd = "/_api/collection/#{@cn}/rotate" |
597 |
| - doc = ArangoDB.log_put("#{prefix}-return-cont", cmd) |
598 |
| - |
599 |
| - sleep 4 |
600 |
| - |
601 |
| - # now continue with the cursor |
602 |
| - cmd = api + "/#{id}" |
603 |
| - doc = ArangoDB.log_put("#{prefix}-return-cont", cmd) |
604 |
| - |
605 |
| - doc.code.should eq(200) |
606 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
607 |
| - doc.parsed_response['error'].should eq(false) |
608 |
| - doc.parsed_response['code'].should eq(200) |
609 |
| - doc.parsed_response['id'].should be_kind_of(String) |
610 |
| - doc.parsed_response['id'].should match(@reId) |
611 |
| - doc.parsed_response['id'].should eq(id) |
612 |
| - doc.parsed_response['hasMore'].should eq(true) |
613 |
| - doc.parsed_response['count'].should eq(2000) |
614 |
| - doc.parsed_response['result'].length.should eq(700) |
615 |
| - |
616 |
| - cmd = api + "/#{id}" |
617 |
| - doc = ArangoDB.log_put("#{prefix}-return-cont2", cmd) |
618 |
| - |
619 |
| - doc.code.should eq(200) |
620 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
621 |
| - doc.parsed_response['error'].should eq(false) |
622 |
| - doc.parsed_response['code'].should eq(200) |
623 |
| - doc.parsed_response['id'].should be_nil |
624 |
| - doc.parsed_response['hasMore'].should eq(false) |
625 |
| - doc.parsed_response['count'].should eq(2000) |
626 |
| - doc.parsed_response['result'].length.should eq(600) |
627 |
| - |
628 |
| - cmd = api + "/#{id}" |
629 |
| - doc = ArangoDB.log_put("#{prefix}-return-cont3", cmd) |
630 |
| - |
631 |
| - doc.code.should eq(404) |
632 |
| - doc.headers['content-type'].should eq("application/json; charset=utf-8") |
633 |
| - doc.parsed_response['error'].should eq(true) |
634 |
| - doc.parsed_response['errorNum'].should eq(1600) |
635 |
| - doc.parsed_response['code'].should eq(404) |
636 |
| - end |
637 | 450 |
|
638 | 451 | it "using limit" do
|
639 | 452 | cmd = api + "?collection=#{@cn}"
|
|
0 commit comments