1
0
Fork 0

Tests/replication tests (#3404) (#3409)

* Improved the arangodb ruby module for tests to allow usage of different databases
* Added Further Tests for non _system database
This commit is contained in:
Michael Hackstein 2017-10-13 12:32:56 +02:00 committed by Frank Celler
parent 107344eeee
commit 5eaf67651d
3 changed files with 2489 additions and 8 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -99,15 +99,47 @@ class ArangoDB
old_value
end
################################################################################
## create a database
################################################################################
def self.create_database (name)
body = "{ \"name\" : \"#{name}\" }"
doc = self.post("/_api/database", :body => body)
if doc.code != 201
return false
end
return true
end
################################################################################
## drop a database
################################################################################
def self.drop_database (name)
body = ""
doc = self.delete("/_api/database/#{name}", :body => body)
if doc.code != 200
return false
end
return true
end
################################################################################
## create a collection
################################################################################
def self.create_collection (name, wait_for_sync = true, type = 2)
def self.create_collection (name, wait_for_sync = true, type = 2, dbname = "_system")
# type 2 means "document collection"
body = "{ \"name\" : \"#{name}\", \"waitForSync\" : #{wait_for_sync}, \"type\" : #{type} }"
doc = self.post("/_api/collection", :body => body)
doc = self.post("/_db/#{dbname}/_api/collection", :body => body)
if doc.code == 409
return doc.parsed_response['id']
@ -124,8 +156,8 @@ class ArangoDB
## drop a collection
################################################################################
def self.drop_collection (name)
cmd = "/_api/collection/#{name}"
def self.drop_collection (name, dbname = "_system")
cmd = "/_db/#{dbname}/_api/collection/#{name}"
self.delete(cmd)
end