1
0
Fork 0

Don't wait eternaly; don't unload collections with rocksdb (#9415)

This commit is contained in:
Wilfried Goesgens 2019-07-05 17:13:25 +02:00 committed by Jan
parent e605c9cd2e
commit 3599aedda1
6 changed files with 548 additions and 432 deletions

View File

@ -863,6 +863,8 @@ function runInRSpec (options, instanceInfo, file, addArgs) {
' c.ARANGO_PASSWORD = "' + options.password + '"\n' + ' c.ARANGO_PASSWORD = "' + options.password + '"\n' +
' c.add_setting :SKIP_TIMECRITICAL\n' + ' c.add_setting :SKIP_TIMECRITICAL\n' +
' c.SKIP_TIMECRITICAL = ' + JSON.stringify(options.skipTimeCritical) + '\n' + ' c.SKIP_TIMECRITICAL = ' + JSON.stringify(options.skipTimeCritical) + '\n' +
' c.add_setting :STORAGE_ENGINE\n' +
' c.STORAGE_ENGINE = ' + JSON.stringify(options.storageEngine) + '\n' +
'end\n'; 'end\n';
fs.write(tmpname, rspecConfig); fs.write(tmpname, rspecConfig);

View File

@ -194,20 +194,25 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
end
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)

View File

@ -6,9 +6,9 @@ require 'arangodb.rb'
describe ArangoDB do describe ArangoDB do
prefix = "api-index-hash" prefix = "api-index-hash"
################################################################################ ################################################################################
## unique constraints during create ## unique constraints during create
################################################################################ ################################################################################
context "creating hash index:" do context "creating hash index:" do
context "dealing with unique constraints violation:" do context "dealing with unique constraints violation:" do
@ -17,11 +17,11 @@ describe ArangoDB do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
@cid = ArangoDB.create_collection(@cn) @cid = ArangoDB.create_collection(@cn)
end end
after do after do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
end end
it "does not create the index in case of violation" do it "does not create the index in case of violation" do
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
@ -126,9 +126,9 @@ describe ArangoDB do
end end
end end
################################################################################ ################################################################################
## unique constraints during create ## unique constraints during create
################################################################################ ################################################################################
context "creating documents:" do context "creating documents:" do
context "dealing with unique constraints:" do context "dealing with unique constraints:" do
@ -137,11 +137,11 @@ describe ArangoDB do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
@cid = ArangoDB.create_collection(@cn) @cid = ArangoDB.create_collection(@cn)
end end
after do after do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
end end
it "rolls back in case of violation, array index w/o deduplication" do it "rolls back in case of violation, array index w/o deduplication" do
cmd = "/_api/index?collection=#{@cn}" cmd = "/_api/index?collection=#{@cn}"
body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a[*]\" ], \"deduplicate\": false }" body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a[*]\" ], \"deduplicate\": false }"
@ -151,24 +151,24 @@ describe ArangoDB do
doc.parsed_response['type'].should eq("hash") doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
doc.parsed_response['deduplicate'].should eq(false) doc.parsed_response['deduplicate'].should eq(false)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : [ 1 ] }" body = "{ \"a\" : [ 1 ] }"
doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body) doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
body = "{ \"a\" : [ 2 ] }" body = "{ \"a\" : [ 2 ] }"
doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body) doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
body = "{ \"a\" : [ 3, 4 ] }" body = "{ \"a\" : [ 3, 4 ] }"
doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body) doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
doc.code.should eq(201) doc.code.should eq(201)
# create a unique constraint violation # create a unique constraint violation
@ -177,7 +177,7 @@ describe ArangoDB do
doc.code.should eq(409) doc.code.should eq(409)
end end
it "rolls back in case of violation, array index" do it "rolls back in case of violation, array index" do
cmd = "/_api/index?collection=#{@cn}" cmd = "/_api/index?collection=#{@cn}"
body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a[*]\" ] }" body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a[*]\" ] }"
@ -187,24 +187,24 @@ describe ArangoDB do
doc.parsed_response['type'].should eq("hash") doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
doc.parsed_response['deduplicate'].should eq(true) doc.parsed_response['deduplicate'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : [ 1, 1 ] }" body = "{ \"a\" : [ 1, 1 ] }"
doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body) doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
body = "{ \"a\" : [ 2 ] }" body = "{ \"a\" : [ 2 ] }"
doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body) doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
body = "{ \"a\" : [ 3, 4 ] }" body = "{ \"a\" : [ 3, 4 ] }"
doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body) doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
body = "{ \"a\" : [ 5, 5 ] }" body = "{ \"a\" : [ 5, 5 ] }"
doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body) doc = ArangoDB.log_post("#{prefix}-create2", cmd1, :body => body)
@ -216,7 +216,7 @@ describe ArangoDB do
doc.code.should eq(409) doc.code.should eq(409)
end end
it "rolls back in case of violation" do it "rolls back in case of violation" do
cmd = "/_api/index?collection=#{@cn}" cmd = "/_api/index?collection=#{@cn}"
body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a\" ] }" body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a\" ] }"
@ -225,7 +225,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("hash") doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -279,34 +279,39 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd3)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -317,7 +322,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("hash") doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -371,42 +376,47 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd3)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
end end
end end
################################################################################ ################################################################################
## unique constraints during update ## unique constraints during update
################################################################################ ################################################################################
context "updating documents:" do context "updating documents:" do
context "dealing with unique constraints:" do context "dealing with unique constraints:" do
@ -415,11 +425,11 @@ describe ArangoDB do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
@cid = ArangoDB.create_collection(@cn) @cid = ArangoDB.create_collection(@cn)
end end
after do after do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
end end
it "rolls back in case of violation" do it "rolls back in case of violation" do
cmd = "/_api/index?collection=#{@cn}" cmd = "/_api/index?collection=#{@cn}"
body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a\" ] }" body = "{ \"type\" : \"hash\", \"unique\" : true, \"fields\" : [ \"a\" ] }"
@ -428,7 +438,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("hash") doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -508,35 +518,40 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd4)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -547,7 +562,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("hash") doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -627,35 +642,40 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd4)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
end end

View File

@ -17,11 +17,11 @@ describe ArangoDB do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
@cid = ArangoDB.create_collection(@cn) @cid = ArangoDB.create_collection(@cn)
end end
after do after do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
end end
it "does not create the index in case of violation" do it "does not create the index in case of violation" do
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
@ -133,11 +133,11 @@ describe ArangoDB do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
@cid = ArangoDB.create_collection(@cn) @cid = ArangoDB.create_collection(@cn)
end end
after do after do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
end end
it "rolls back in case of violation" do it "rolls back in case of violation" do
cmd = "/_api/index?collection=#{@cn}" cmd = "/_api/index?collection=#{@cn}"
body = "{ \"type\" : \"persistent\", \"unique\" : true, \"fields\" : [ \"a\" ] }" body = "{ \"type\" : \"persistent\", \"unique\" : true, \"fields\" : [ \"a\" ] }"
@ -146,7 +146,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("persistent") doc.parsed_response['type'].should eq("persistent")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -200,33 +200,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -237,7 +242,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("persistent") doc.parsed_response['type'].should eq("persistent")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -291,33 +296,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
end end
end end
@ -333,11 +343,11 @@ describe ArangoDB do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
@cid = ArangoDB.create_collection(@cn) @cid = ArangoDB.create_collection(@cn)
end end
after do after do
ArangoDB.drop_collection(@cn) ArangoDB.drop_collection(@cn)
end end
it "rolls back in case of violation" do it "rolls back in case of violation" do
cmd = "/_api/index?collection=#{@cn}" cmd = "/_api/index?collection=#{@cn}"
body = "{ \"type\" : \"persistent\", \"unique\" : true, \"fields\" : [ \"a\" ] }" body = "{ \"type\" : \"persistent\", \"unique\" : true, \"fields\" : [ \"a\" ] }"
@ -346,7 +356,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("persistent") doc.parsed_response['type'].should eq("persistent")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -426,34 +436,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -464,7 +479,7 @@ describe ArangoDB do
doc.code.should eq(201) doc.code.should eq(201)
doc.parsed_response['type'].should eq("persistent") doc.parsed_response['type'].should eq("persistent")
doc.parsed_response['unique'].should eq(true) doc.parsed_response['unique'].should eq(true)
# create a document # create a document
cmd1 = "/_api/document?collection=#{@cn}" cmd1 = "/_api/document?collection=#{@cn}"
body = "{ \"a\" : 1, \"b\" : 1 }" body = "{ \"a\" : 1, \"b\" : 1 }"
@ -544,34 +559,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
end end

View File

@ -200,33 +200,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -291,33 +296,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
end end
end end
@ -426,34 +436,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -544,34 +559,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
end end

View File

@ -160,33 +160,39 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
cmd = api + "/#{iid}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
doc.headers['content-type'].should eq("application/json; charset=utf-8")
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['id'].should match(@reFull)
doc.parsed_response['id'].should eq(iid)
doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true)
doc.parsed_response['sparse'].should eq(false)
doc.parsed_response['fields'].should eq([ "a", "b" ])
end end
cmd = api + "/#{iid}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
doc.headers['content-type'].should eq("application/json; charset=utf-8")
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['id'].should match(@reFull)
doc.parsed_response['id'].should eq(iid)
doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true)
doc.parsed_response['sparse'].should eq(false)
doc.parsed_response['fields'].should eq([ "a", "b" ])
end end
it "survives unload, sparse index" do it "survives unload, sparse index" do
@ -202,18 +208,25 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -376,18 +389,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -418,18 +437,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -592,18 +617,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -634,18 +665,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -774,18 +811,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -816,18 +859,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"