arangorb 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ArangoRB.gemspec +18 -18
- data/Gemfile +8 -7
- data/LICENSE +21 -21
- data/README.md +906 -867
- data/lib/ArangoRB_AQL.rb +181 -160
- data/lib/ArangoRB_Cache.rb +174 -174
- data/lib/ArangoRB_Col.rb +526 -499
- data/lib/ArangoRB_DB.rb +363 -339
- data/lib/ArangoRB_Doc.rb +319 -298
- data/lib/ArangoRB_Edg.rb +184 -169
- data/lib/ArangoRB_Gra.rb +201 -180
- data/lib/ArangoRB_Index.rb +135 -115
- data/lib/ArangoRB_Replication.rb +261 -0
- data/lib/ArangoRB_Ser.rb +446 -441
- data/lib/ArangoRB_Task.rb +129 -113
- data/lib/ArangoRB_Tra.rb +169 -142
- data/lib/ArangoRB_Tran.rb +68 -53
- data/lib/ArangoRB_User.rb +149 -136
- data/lib/ArangoRB_Ver.rb +162 -147
- data/lib/arangorb.rb +16 -15
- data/spec/arangoRB_helper.rb +4 -4
- data/spec/arangoRestart_helper.rb +14 -14
- data/spec/lib/0.1.0/arangoAQL_helper.rb +64 -64
- data/spec/lib/0.1.0/arangoC_helper.rb +170 -170
- data/spec/lib/0.1.0/arangoDB_helper.rb +119 -119
- data/spec/lib/0.1.0/arangoDoc_helper.rb +79 -79
- data/spec/lib/0.1.0/arangoE_helper.rb +50 -50
- data/spec/lib/0.1.0/arangoG_helper.rb +78 -78
- data/spec/lib/0.1.0/arangoS_helper.rb +37 -37
- data/spec/lib/0.1.0/arangoT_helper.rb +48 -48
- data/spec/lib/0.1.0/arangoV_helper.rb +65 -65
- data/spec/lib/1.0.0/arangoC_helper.rb +73 -73
- data/spec/lib/1.0.0/arangoDB_helper.rb +48 -48
- data/spec/lib/1.0.0/arangoI_helper.rb +43 -43
- data/spec/lib/1.0.0/arangoS_helper.rb +192 -192
- data/spec/lib/1.0.0/arangoTa_helper.rb +49 -49
- data/spec/lib/1.0.0/arangoTr_helper.rb +15 -15
- data/spec/lib/1.0.0/arangoU_helper.rb +72 -72
- data/spec/lib/1.1.0/arangoRB_helper.rb +144 -144
- data/spec/lib/1.1.0/arangoRB_walks_helper.rb +19 -19
- data/spec/lib/1.2.0/arangoCache_helper.rb +66 -66
- data/spec/lib/1.3.0/arangoHash_helper.rb +30 -0
- data/spec/lib/arangoRB_0.1.0_helper.rb +9 -9
- data/spec/lib/arangoRB_1.0.0_helper.rb +6 -6
- data/spec/lib/arangoRB_1.1.0_helper.rb +2 -2
- data/spec/lib/arangoRB_1.2.0_helper.rb +2 -1
- data/spec/spec_helper.rb +41 -41
- metadata +6 -5
@@ -1,73 +1,73 @@
|
|
1
|
-
require_relative './../../spec_helper'
|
2
|
-
|
3
|
-
describe ArangoCollection do
|
4
|
-
context "#get" do
|
5
|
-
it "revision" do
|
6
|
-
expect(@myCollection.revision.to_i).to be >= 1
|
7
|
-
end
|
8
|
-
|
9
|
-
it "collection" do
|
10
|
-
expect(@myCollection.rotate).to eq "could not rotate journal: no journal"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context "#import" do
|
15
|
-
it "import" do
|
16
|
-
attributes = ["value", "num", "name"]
|
17
|
-
values = [["uno",1,"ONE"],["due",2,"TWO"],["tre",3,"THREE"]]
|
18
|
-
result = @myCollection.import attributes: attributes, values: values
|
19
|
-
expect(result["created"]).to eq 3
|
20
|
-
end
|
21
|
-
|
22
|
-
it "import single" do
|
23
|
-
attributes = ["value", "num", "name"]
|
24
|
-
values = ["uno",1,"ONE"]
|
25
|
-
result = @myCollection.import attributes: attributes, values: values
|
26
|
-
expect(result["created"]).to eq 1
|
27
|
-
end
|
28
|
-
|
29
|
-
it "importJSON" do
|
30
|
-
body = [{"value": "uno", "num": 1, "name": "ONE"}, {"value": "due", "num": 2, "name": "DUE"}]
|
31
|
-
result = @myCollection.importJSON body: body
|
32
|
-
expect(result["created"]).to eq 2
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "#export" do
|
37
|
-
it "export" do
|
38
|
-
result = @myCollection.export
|
39
|
-
expect(result[0].class).to be ArangoDocument
|
40
|
-
end
|
41
|
-
|
42
|
-
it "exportNext" do
|
43
|
-
result = @myCollection.export batchSize: 3
|
44
|
-
result = @myCollection.exportNext
|
45
|
-
expect(result[0].class).to be ArangoDocument
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "#indexes" do
|
50
|
-
it "indexes" do
|
51
|
-
expect(@myCollection.indexes["indexes"][0].class).to be ArangoIndex
|
52
|
-
end
|
53
|
-
#
|
54
|
-
# it "retrieve" do
|
55
|
-
# expect((@myCollection.retrieveIndex id: 0).unique).to be true
|
56
|
-
# end
|
57
|
-
#
|
58
|
-
it "create" do
|
59
|
-
myIndex = @myCollection.createIndex unique: false, fields: "num", type: "hash"
|
60
|
-
expect(myIndex.fields).to eq ["num"]
|
61
|
-
end
|
62
|
-
#
|
63
|
-
# it "delete" do
|
64
|
-
# expect(@myCollection.deleteIndex id: @myIndex.key).to eq true
|
65
|
-
# end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "#replication" do
|
69
|
-
it "data" do
|
70
|
-
expect(@myCollection.data.length).to be > 100
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe ArangoCollection do
|
4
|
+
context "#get" do
|
5
|
+
it "revision" do
|
6
|
+
expect(@myCollection.revision.to_i).to be >= 1
|
7
|
+
end
|
8
|
+
|
9
|
+
it "collection" do
|
10
|
+
expect(@myCollection.rotate).to eq "could not rotate journal: no journal"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "#import" do
|
15
|
+
it "import" do
|
16
|
+
attributes = ["value", "num", "name"]
|
17
|
+
values = [["uno",1,"ONE"],["due",2,"TWO"],["tre",3,"THREE"]]
|
18
|
+
result = @myCollection.import attributes: attributes, values: values
|
19
|
+
expect(result["created"]).to eq 3
|
20
|
+
end
|
21
|
+
|
22
|
+
it "import single" do
|
23
|
+
attributes = ["value", "num", "name"]
|
24
|
+
values = ["uno",1,"ONE"]
|
25
|
+
result = @myCollection.import attributes: attributes, values: values
|
26
|
+
expect(result["created"]).to eq 1
|
27
|
+
end
|
28
|
+
|
29
|
+
it "importJSON" do
|
30
|
+
body = [{"value": "uno", "num": 1, "name": "ONE"}, {"value": "due", "num": 2, "name": "DUE"}]
|
31
|
+
result = @myCollection.importJSON body: body
|
32
|
+
expect(result["created"]).to eq 2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "#export" do
|
37
|
+
it "export" do
|
38
|
+
result = @myCollection.export
|
39
|
+
expect(result[0].class).to be ArangoDocument
|
40
|
+
end
|
41
|
+
|
42
|
+
it "exportNext" do
|
43
|
+
result = @myCollection.export batchSize: 3
|
44
|
+
result = @myCollection.exportNext
|
45
|
+
expect(result[0].class).to be ArangoDocument
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "#indexes" do
|
50
|
+
it "indexes" do
|
51
|
+
expect(@myCollection.indexes["indexes"][0].class).to be ArangoIndex
|
52
|
+
end
|
53
|
+
#
|
54
|
+
# it "retrieve" do
|
55
|
+
# expect((@myCollection.retrieveIndex id: 0).unique).to be true
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
it "create" do
|
59
|
+
myIndex = @myCollection.createIndex unique: false, fields: "num", type: "hash"
|
60
|
+
expect(myIndex.fields).to eq ["num"]
|
61
|
+
end
|
62
|
+
#
|
63
|
+
# it "delete" do
|
64
|
+
# expect(@myCollection.deleteIndex id: @myIndex.key).to eq true
|
65
|
+
# end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "#replication" do
|
69
|
+
it "data" do
|
70
|
+
expect(@myCollection.data.length).to be > 100
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -1,48 +1,48 @@
|
|
1
|
-
require_relative './../../spec_helper'
|
2
|
-
|
3
|
-
describe ArangoDatabase do
|
4
|
-
context "#replication" do
|
5
|
-
it "inventory" do
|
6
|
-
expect(@myDatabase.inventory["collections"].class).to be Array
|
7
|
-
end
|
8
|
-
|
9
|
-
it "clusterInventory" do
|
10
|
-
expect(@myDatabase.clusterInventory).to eq "this operation is only valid on a coordinator in a cluster"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "logger" do
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
it "lastLogger" do
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
it "fistTick" do
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
it "rangeTick" do
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
it "configurationReplication" do
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
it "modifyConfigurationReplication" do
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "#user" do
|
40
|
-
it "grant" do
|
41
|
-
expect(@myDatabase.grant user: @myUser).to be true
|
42
|
-
end
|
43
|
-
|
44
|
-
it "revoke" do
|
45
|
-
expect(@myDatabase.revoke user: @myUser).to be true
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe ArangoDatabase do
|
4
|
+
context "#replication" do
|
5
|
+
it "inventory" do
|
6
|
+
expect(@myDatabase.inventory["collections"].class).to be Array
|
7
|
+
end
|
8
|
+
|
9
|
+
it "clusterInventory" do
|
10
|
+
expect(@myDatabase.clusterInventory).to eq "this operation is only valid on a coordinator in a cluster"
|
11
|
+
end
|
12
|
+
|
13
|
+
# it "logger" do
|
14
|
+
# expect(@myDatabase.logger["state"]["running"]).to be true
|
15
|
+
# end
|
16
|
+
|
17
|
+
# it "lastLogger" do
|
18
|
+
# expect(@myDatabase.loggerFollow.class).to be String
|
19
|
+
# end
|
20
|
+
|
21
|
+
# it "fistTick" do
|
22
|
+
# expect(@myDatabase.firstTick.to_i).to be >= 1
|
23
|
+
# end
|
24
|
+
|
25
|
+
# it "rangeTick" do
|
26
|
+
# expect(@myDatabase.rangeTick[0]["datafile"].class).to be String
|
27
|
+
# end
|
28
|
+
|
29
|
+
# it "configurationReplication" do
|
30
|
+
# expect(@myDatabase.configurationReplication["requestTimeout"]).to eq 600
|
31
|
+
# end
|
32
|
+
|
33
|
+
# it "modifyConfigurationReplication" do
|
34
|
+
# result = @myDatabase.modifyConfigurationReplication autoStart: true
|
35
|
+
# expect(result["autoStart"]).to be true
|
36
|
+
# end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "#user" do
|
40
|
+
it "grant" do
|
41
|
+
expect(@myDatabase.grant user: @myUser).to be true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "revoke" do
|
45
|
+
expect(@myDatabase.revoke user: @myUser).to be true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,43 +1,43 @@
|
|
1
|
-
require_relative './../../spec_helper'
|
2
|
-
|
3
|
-
describe ArangoIndex do
|
4
|
-
context "#new" do
|
5
|
-
it "create a new Index without global" do
|
6
|
-
myIndex = ArangoIndex.new collection: @myCollection, database: @myDatabase, fields: "num", unique: false, id: "myIndex"
|
7
|
-
expect(myIndex.id).to eq "myIndex"
|
8
|
-
end
|
9
|
-
|
10
|
-
it "create a new Index with global" do
|
11
|
-
myIndex = ArangoIndex.new fields: "num", unique: false, id: "myIndex2"
|
12
|
-
expect(myIndex.id).to eq "myIndex2"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "#create" do
|
17
|
-
it "create a new Index" do
|
18
|
-
result = @myIndex.create
|
19
|
-
expect(result.type).to eq "hash"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "#retrieve" do
|
24
|
-
it "retrieve an Index" do
|
25
|
-
result = @myIndex.retrieve
|
26
|
-
expect(result.type).to eq "hash"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "#info" do
|
31
|
-
it "list Indexes" do
|
32
|
-
result = ArangoIndex.indexes
|
33
|
-
expect(result["indexes"][0].class).to be ArangoIndex
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context "#destroy" do
|
38
|
-
it "destroy" do
|
39
|
-
result = @myIndex.destroy
|
40
|
-
expect(result).to be true
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe ArangoIndex do
|
4
|
+
context "#new" do
|
5
|
+
it "create a new Index without global" do
|
6
|
+
myIndex = ArangoIndex.new collection: @myCollection, database: @myDatabase, fields: "num", unique: false, id: "myIndex"
|
7
|
+
expect(myIndex.id).to eq "myIndex"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "create a new Index with global" do
|
11
|
+
myIndex = ArangoIndex.new fields: "num", unique: false, id: "myIndex2"
|
12
|
+
expect(myIndex.id).to eq "myIndex2"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "#create" do
|
17
|
+
it "create a new Index" do
|
18
|
+
result = @myIndex.create
|
19
|
+
expect(result.type).to eq "hash"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "#retrieve" do
|
24
|
+
it "retrieve an Index" do
|
25
|
+
result = @myIndex.retrieve
|
26
|
+
expect(result.type).to eq "hash"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "#info" do
|
31
|
+
it "list Indexes" do
|
32
|
+
result = ArangoIndex.indexes
|
33
|
+
expect(result["indexes"][0].class).to be ArangoIndex
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "#destroy" do
|
38
|
+
it "destroy" do
|
39
|
+
result = @myIndex.destroy
|
40
|
+
expect(result).to be true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,192 +1,192 @@
|
|
1
|
-
require_relative './../../spec_helper'
|
2
|
-
|
3
|
-
describe ArangoServer do
|
4
|
-
context "#general" do
|
5
|
-
it "address" do
|
6
|
-
expect(ArangoServer.address).to eq "localhost:8529"
|
7
|
-
end
|
8
|
-
|
9
|
-
it "username" do
|
10
|
-
expect(ArangoServer.username).to eq "root"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "request" do
|
14
|
-
expect(ArangoServer.request[":body"].class).to be NilClass
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "#user" do
|
19
|
-
it "setup a global user" do
|
20
|
-
ArangoServer.user = "MyUser2"
|
21
|
-
expect(ArangoServer.user.name).to eq "MyUser2"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "#monitoring" do
|
26
|
-
it "log" do
|
27
|
-
expect(ArangoServer.log["totalAmount"]).to be >= 0
|
28
|
-
end
|
29
|
-
|
30
|
-
it "reload" do
|
31
|
-
expect(ArangoServer.reload).to be true
|
32
|
-
end
|
33
|
-
|
34
|
-
it "statistics" do
|
35
|
-
expect(ArangoServer.statistics["enabled"]).to be true
|
36
|
-
end
|
37
|
-
|
38
|
-
it "statisticsDescription" do
|
39
|
-
expect(ArangoServer.statistics(description: true)["groups"][0].nil?).to be false
|
40
|
-
end
|
41
|
-
|
42
|
-
it "role" do
|
43
|
-
expect(ArangoServer.role.class).to eq String
|
44
|
-
end
|
45
|
-
|
46
|
-
# it "server" do
|
47
|
-
# expect(ArangoServer.server.class).to eq String
|
48
|
-
# end
|
49
|
-
|
50
|
-
it "serverID" do
|
51
|
-
expect(ArangoServer.serverId.to_i).to be >= 1
|
52
|
-
end
|
53
|
-
|
54
|
-
# it "clusterStatistics" do
|
55
|
-
# expect(ArangoServer.clusterStatistics.class).to eq String
|
56
|
-
# end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "#lists" do
|
60
|
-
it "endpoints" do
|
61
|
-
expect(ArangoServer.endpoints[0].keys[0]).to eq "endpoint"
|
62
|
-
end
|
63
|
-
|
64
|
-
it "users" do
|
65
|
-
expect(ArangoServer.users[0].class).to be ArangoUser
|
66
|
-
end
|
67
|
-
|
68
|
-
it "databases" do
|
69
|
-
expect(ArangoServer.databases[0].class).to be ArangoDatabase
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "#async" do
|
74
|
-
it "create async" do
|
75
|
-
ArangoServer.async = "store"
|
76
|
-
expect(ArangoServer.async).to eq "store"
|
77
|
-
end
|
78
|
-
|
79
|
-
it "pendingAsync" do
|
80
|
-
ArangoServer.async = "store"
|
81
|
-
ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
82
|
-
expect(ArangoServer.pendingAsync).to eq []
|
83
|
-
end
|
84
|
-
|
85
|
-
it "fetchAsync" do
|
86
|
-
ArangoServer.async = "store"
|
87
|
-
id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
88
|
-
expect(ArangoServer.fetchAsync(id: id)["count"]).to eq 18
|
89
|
-
end
|
90
|
-
|
91
|
-
it "retrieveAsync" do
|
92
|
-
ArangoServer.async = "store"
|
93
|
-
ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
94
|
-
expect(ArangoServer.retrievePendingAsync).to eq []
|
95
|
-
end
|
96
|
-
|
97
|
-
it "cancelAsync" do
|
98
|
-
ArangoServer.async = "store"
|
99
|
-
id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
100
|
-
expect(ArangoServer.cancelAsync(id: id)).to eq "not found"
|
101
|
-
end
|
102
|
-
|
103
|
-
it "destroyAsync" do
|
104
|
-
ArangoServer.async = "store"
|
105
|
-
id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
106
|
-
expect(ArangoServer.destroyAsync type: id).to be true
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context "#batch" do
|
111
|
-
it "batch" do
|
112
|
-
ArangoServer.async = false
|
113
|
-
ArangoCollection.new.create
|
114
|
-
queries = [{
|
115
|
-
"type": "POST",
|
116
|
-
"address": "/_db/MyDatabase/_api/collection",
|
117
|
-
"body": {"name": "newCOLLECTION"},
|
118
|
-
"id": "1"
|
119
|
-
},
|
120
|
-
{
|
121
|
-
"type": "GET",
|
122
|
-
"address": "/_api/database",
|
123
|
-
"id": "2"
|
124
|
-
}]
|
125
|
-
expect((ArangoServer.batch queries: queries).class).to be String
|
126
|
-
end
|
127
|
-
|
128
|
-
it "createDumpBatch" do
|
129
|
-
expect((ArangoServer.createDumpBatch ttl: 100).to_i).to be > 1
|
130
|
-
end
|
131
|
-
|
132
|
-
it "prolongDumpBatch" do
|
133
|
-
dumpBatchID = ArangoServer.createDumpBatch ttl: 100
|
134
|
-
expect((ArangoServer.prolongDumpBatch ttl: 100, id: dumpBatchID).to_i).to be > 1
|
135
|
-
end
|
136
|
-
|
137
|
-
it "destroyDumpBatch" do
|
138
|
-
dumpBatchID = ArangoServer.createDumpBatch ttl: 100
|
139
|
-
expect(ArangoServer.destroyDumpBatch id: dumpBatchID).to be true
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
context "#task" do
|
144
|
-
it "tasks" do
|
145
|
-
result = ArangoServer.tasks
|
146
|
-
expect(result[0].id.class).to be String
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
context "#miscellaneous" do
|
151
|
-
it "version" do
|
152
|
-
expect(ArangoServer.version["server"]).to eq "arango"
|
153
|
-
end
|
154
|
-
|
155
|
-
it "propertyWAL" do
|
156
|
-
ArangoServer.changePropertyWAL historicLogfiles: 14
|
157
|
-
expect(ArangoServer.propertyWAL["historicLogfiles"]).to eq 14
|
158
|
-
end
|
159
|
-
|
160
|
-
it "flushWAL" do
|
161
|
-
expect(ArangoServer.flushWAL).to be true
|
162
|
-
end
|
163
|
-
|
164
|
-
it "transactions" do
|
165
|
-
expect(ArangoServer.transactions["runningTransactions"]).to be >= 0
|
166
|
-
end
|
167
|
-
|
168
|
-
it "time" do
|
169
|
-
expect(ArangoServer.time.class).to be Float
|
170
|
-
end
|
171
|
-
|
172
|
-
it "echo" do
|
173
|
-
expect(ArangoServer.echo["user"]).to eq "root"
|
174
|
-
end
|
175
|
-
|
176
|
-
it "databaseVersion" do
|
177
|
-
expect(ArangoServer.databaseVersion.to_i).to be >= 1
|
178
|
-
end
|
179
|
-
|
180
|
-
it "sleep" do
|
181
|
-
expect(ArangoServer.sleep duration: 10).to be >= 1
|
182
|
-
end
|
183
|
-
|
184
|
-
# it "shutdown" do
|
185
|
-
# result = ArangoServer.shutdown
|
186
|
-
# `sudo service arangodb restart`
|
187
|
-
# expect(result).to eq "OK"
|
188
|
-
# end
|
189
|
-
end
|
190
|
-
|
191
|
-
|
192
|
-
end
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe ArangoServer do
|
4
|
+
context "#general" do
|
5
|
+
it "address" do
|
6
|
+
expect(ArangoServer.address).to eq "localhost:8529"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "username" do
|
10
|
+
expect(ArangoServer.username).to eq "root"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "request" do
|
14
|
+
expect(ArangoServer.request[":body"].class).to be NilClass
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "#user" do
|
19
|
+
it "setup a global user" do
|
20
|
+
ArangoServer.user = "MyUser2"
|
21
|
+
expect(ArangoServer.user.name).to eq "MyUser2"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "#monitoring" do
|
26
|
+
it "log" do
|
27
|
+
expect(ArangoServer.log["totalAmount"]).to be >= 0
|
28
|
+
end
|
29
|
+
|
30
|
+
it "reload" do
|
31
|
+
expect(ArangoServer.reload).to be true
|
32
|
+
end
|
33
|
+
|
34
|
+
it "statistics" do
|
35
|
+
expect(ArangoServer.statistics["enabled"]).to be true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "statisticsDescription" do
|
39
|
+
expect(ArangoServer.statistics(description: true)["groups"][0].nil?).to be false
|
40
|
+
end
|
41
|
+
|
42
|
+
it "role" do
|
43
|
+
expect(ArangoServer.role.class).to eq String
|
44
|
+
end
|
45
|
+
|
46
|
+
# it "server" do
|
47
|
+
# expect(ArangoServer.server.class).to eq String
|
48
|
+
# end
|
49
|
+
|
50
|
+
it "serverID" do
|
51
|
+
expect(ArangoServer.serverId.to_i).to be >= 1
|
52
|
+
end
|
53
|
+
|
54
|
+
# it "clusterStatistics" do
|
55
|
+
# expect(ArangoServer.clusterStatistics.class).to eq String
|
56
|
+
# end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "#lists" do
|
60
|
+
it "endpoints" do
|
61
|
+
expect(ArangoServer.endpoints[0].keys[0]).to eq "endpoint"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "users" do
|
65
|
+
expect(ArangoServer.users[0].class).to be ArangoUser
|
66
|
+
end
|
67
|
+
|
68
|
+
it "databases" do
|
69
|
+
expect(ArangoServer.databases[0].class).to be ArangoDatabase
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "#async" do
|
74
|
+
it "create async" do
|
75
|
+
ArangoServer.async = "store"
|
76
|
+
expect(ArangoServer.async).to eq "store"
|
77
|
+
end
|
78
|
+
|
79
|
+
it "pendingAsync" do
|
80
|
+
ArangoServer.async = "store"
|
81
|
+
ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
82
|
+
expect(ArangoServer.pendingAsync).to eq []
|
83
|
+
end
|
84
|
+
|
85
|
+
it "fetchAsync" do
|
86
|
+
ArangoServer.async = "store"
|
87
|
+
id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
88
|
+
expect(ArangoServer.fetchAsync(id: id)["count"]).to eq 18
|
89
|
+
end
|
90
|
+
|
91
|
+
it "retrieveAsync" do
|
92
|
+
ArangoServer.async = "store"
|
93
|
+
ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
94
|
+
expect(ArangoServer.retrievePendingAsync).to eq []
|
95
|
+
end
|
96
|
+
|
97
|
+
it "cancelAsync" do
|
98
|
+
ArangoServer.async = "store"
|
99
|
+
id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
100
|
+
expect(ArangoServer.cancelAsync(id: id)).to eq "not found"
|
101
|
+
end
|
102
|
+
|
103
|
+
it "destroyAsync" do
|
104
|
+
ArangoServer.async = "store"
|
105
|
+
id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
106
|
+
expect(ArangoServer.destroyAsync type: id).to be true
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context "#batch" do
|
111
|
+
it "batch" do
|
112
|
+
ArangoServer.async = false
|
113
|
+
ArangoCollection.new.create
|
114
|
+
queries = [{
|
115
|
+
"type": "POST",
|
116
|
+
"address": "/_db/MyDatabase/_api/collection",
|
117
|
+
"body": {"name": "newCOLLECTION"},
|
118
|
+
"id": "1"
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"type": "GET",
|
122
|
+
"address": "/_api/database",
|
123
|
+
"id": "2"
|
124
|
+
}]
|
125
|
+
expect((ArangoServer.batch queries: queries).class).to be String
|
126
|
+
end
|
127
|
+
|
128
|
+
it "createDumpBatch" do
|
129
|
+
expect((ArangoServer.createDumpBatch ttl: 100).to_i).to be > 1
|
130
|
+
end
|
131
|
+
|
132
|
+
it "prolongDumpBatch" do
|
133
|
+
dumpBatchID = ArangoServer.createDumpBatch ttl: 100
|
134
|
+
expect((ArangoServer.prolongDumpBatch ttl: 100, id: dumpBatchID).to_i).to be > 1
|
135
|
+
end
|
136
|
+
|
137
|
+
it "destroyDumpBatch" do
|
138
|
+
dumpBatchID = ArangoServer.createDumpBatch ttl: 100
|
139
|
+
expect(ArangoServer.destroyDumpBatch id: dumpBatchID).to be true
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context "#task" do
|
144
|
+
it "tasks" do
|
145
|
+
result = ArangoServer.tasks
|
146
|
+
expect(result[0].id.class).to be String
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context "#miscellaneous" do
|
151
|
+
it "version" do
|
152
|
+
expect(ArangoServer.version["server"]).to eq "arango"
|
153
|
+
end
|
154
|
+
|
155
|
+
it "propertyWAL" do
|
156
|
+
ArangoServer.changePropertyWAL historicLogfiles: 14
|
157
|
+
expect(ArangoServer.propertyWAL["historicLogfiles"]).to eq 14
|
158
|
+
end
|
159
|
+
|
160
|
+
it "flushWAL" do
|
161
|
+
expect(ArangoServer.flushWAL).to be true
|
162
|
+
end
|
163
|
+
|
164
|
+
it "transactions" do
|
165
|
+
expect(ArangoServer.transactions["runningTransactions"]).to be >= 0
|
166
|
+
end
|
167
|
+
|
168
|
+
it "time" do
|
169
|
+
expect(ArangoServer.time.class).to be Float
|
170
|
+
end
|
171
|
+
|
172
|
+
it "echo" do
|
173
|
+
expect(ArangoServer.echo["user"]).to eq "root"
|
174
|
+
end
|
175
|
+
|
176
|
+
it "databaseVersion" do
|
177
|
+
expect(ArangoServer.databaseVersion.to_i).to be >= 1
|
178
|
+
end
|
179
|
+
|
180
|
+
it "sleep" do
|
181
|
+
expect(ArangoServer.sleep duration: 10).to be >= 1
|
182
|
+
end
|
183
|
+
|
184
|
+
# it "shutdown" do
|
185
|
+
# result = ArangoServer.shutdown
|
186
|
+
# `sudo service arangodb restart`
|
187
|
+
# expect(result).to eq "OK"
|
188
|
+
# end
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
end
|