Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 124ce47

Browse files
committed
testing: test DFS and BFS executors both
Enabled for common, extra and space test suites. Bench suite have been left untouched and always uses fastest executor.
1 parent c5d630c commit 124ce47

22 files changed

+297
-127
lines changed

test/common/query_timeout.test.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ test_run = test_run and test_run.new()
1616

1717
local e = graphql.error_codes
1818

19-
local apply_settings_to = test_run and test_run:get_cfg('apply_settings_to') or
19+
local apply_timeout_to = test_run and test_run:get_cfg('apply_timeout_to') or
2020
'graphql'
21-
local settings = {
21+
local test_graphql_opts = {
2222
timeout_ms = 0.001,
2323
}
2424

@@ -41,7 +41,7 @@ local function run_queries(gql_wrapper)
4141
}
4242
]]
4343

44-
local query_opts = apply_settings_to == 'query' and settings or nil
44+
local query_opts = apply_timeout_to == 'query' and test_graphql_opts or nil
4545
local gql_query = gql_wrapper:compile(query, query_opts)
4646
local variables = {}
4747
local result = gql_query:execute(variables)
@@ -57,7 +57,7 @@ end
5757

5858
box.cfg({})
5959

60-
local graphql_opts = apply_settings_to == 'graphql' and settings or nil
60+
local graphql_opts = apply_timeout_to == 'graphql' and test_graphql_opts or nil
6161
test_utils.run_testdata(testdata, {
6262
run_queries = run_queries,
6363
graphql_opts = graphql_opts,

test/common/suite.cfg

Lines changed: 120 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,126 @@
11
{
22
"query_timeout.test.lua": {
3-
"space (g)": {"conf": "space", "apply_settings_to": "graphql"},
4-
"shard_2x2 (g)": {"conf": "shard_2x2", "apply_settings_to": "graphql"},
5-
"shard_4x1 (g)": {"conf": "shard_4x1", "apply_settings_to": "graphql"},
6-
"space (q)": {"conf": "space", "apply_settings_to": "query"},
7-
"shard_2x2 (q)": {"conf": "shard_2x2", "apply_settings_to": "query"},
8-
"shard_4x1 (q)": {"conf": "shard_4x1", "apply_settings_to": "query"}
3+
"space (dfs, g)": {
4+
"conf": "space",
5+
"apply_timeout_to": "graphql",
6+
"graphql_opts": {
7+
"use_bfs_executor": "never"
8+
}
9+
},
10+
"space (bfs, g)": {
11+
"conf": "space",
12+
"apply_timeout_to": "graphql",
13+
"graphql_opts": {
14+
"use_bfs_executor": "always"
15+
}
16+
},
17+
"shard_2x2 (dfs, g)": {
18+
"conf": "shard_2x2",
19+
"apply_timeout_to": "graphql",
20+
"graphql_opts": {
21+
"use_bfs_executor": "never"
22+
}
23+
},
24+
"shard_2x2 (bfs, g)": {
25+
"conf": "shard_2x2",
26+
"apply_timeout_to": "graphql",
27+
"graphql_opts": {
28+
"use_bfs_executor": "always"
29+
}
30+
},
31+
"shard_4x1 (dfs, g)": {
32+
"conf": "shard_4x1",
33+
"apply_timeout_to": "graphql",
34+
"graphql_opts": {
35+
"use_bfs_executor": "never"
36+
}
37+
},
38+
"shard_4x1 (bfs, g)": {
39+
"conf": "shard_4x1",
40+
"apply_timeout_to": "graphql",
41+
"graphql_opts": {
42+
"use_bfs_executor": "always"
43+
}
44+
},
45+
"space (dfs, q)": {
46+
"conf": "space",
47+
"apply_timeout_to": "query",
48+
"graphql_opts": {
49+
"use_bfs_executor": "never"
50+
}
51+
},
52+
"space (bfs, q)": {
53+
"conf": "space",
54+
"apply_timeout_to": "query",
55+
"graphql_opts": {
56+
"use_bfs_executor": "always"
57+
}
58+
},
59+
"shard_2x2 (dfs, q)": {
60+
"conf": "shard_2x2",
61+
"apply_timeout_to": "query",
62+
"graphql_opts": {
63+
"use_bfs_executor": "never"
64+
}
65+
},
66+
"shard_2x2 (bfs, q)": {
67+
"conf": "shard_2x2",
68+
"apply_timeout_to": "query",
69+
"graphql_opts": {
70+
"use_bfs_executor": "always"
71+
}
72+
},
73+
"shard_4x1 (dfs, q)": {
74+
"conf": "shard_4x1",
75+
"apply_timeout_to": "query",
76+
"graphql_opts": {
77+
"use_bfs_executor": "never"
78+
}
79+
},
80+
"shard_4x1 (bfs, q)": {
81+
"conf": "shard_4x1",
82+
"apply_timeout_to": "query",
83+
"graphql_opts": {
84+
"use_bfs_executor": "always"
85+
}
86+
}
987
},
1088
"*": {
11-
"space": {"conf": "space"},
12-
"shard_2x2": {"conf": "shard_2x2"},
13-
"shard_4x1": {"conf": "shard_4x1"}
89+
"space (dfs)": {
90+
"conf": "space",
91+
"graphql_opts": {
92+
"use_bfs_executor": "never"
93+
}
94+
},
95+
"space (bfs)": {
96+
"conf": "space",
97+
"graphql_opts": {
98+
"use_bfs_executor": "always"
99+
}
100+
},
101+
"shard_2x2 (dfs)": {
102+
"conf": "shard_2x2",
103+
"graphql_opts": {
104+
"use_bfs_executor": "never"
105+
}
106+
},
107+
"shard_2x2 (bfs)": {
108+
"conf": "shard_2x2",
109+
"graphql_opts": {
110+
"use_bfs_executor": "always"
111+
}
112+
},
113+
"shard_4x1 (dfs)": {
114+
"conf": "shard_4x1",
115+
"graphql_opts": {
116+
"use_bfs_executor": "never"
117+
}
118+
},
119+
"shard_4x1 (bfs)": {
120+
"conf": "shard_4x1",
121+
"graphql_opts": {
122+
"use_bfs_executor": "always"
123+
}
124+
}
14125
}
15126
}

test/extra/connections_1_1_name_clash.test.lua

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
#!/usr/bin/env tarantool
2+
23
local fio = require('fio')
34
local json = require('json')
4-
local test = require('tap').test('connections 1:1 name clash')
5+
local tap = require('tap')
56

67
-- require in-repo version of graphql/ sources despite current working directory
78
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
89
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' ..
910
package.path
1011

1112
local graphql = require('graphql')
13+
local utils = require('graphql.utils')
14+
local test_utils = require('test.test_utils')
15+
16+
local test = tap.test('connections 1:1 name clash')
1217

13-
box.cfg{ wal_mode="none" }
18+
box.cfg{wal_mode="none"}
1419
test:plan(3)
1520

1621
local schemas = json.decode([[{
@@ -181,13 +186,13 @@ local indexes = {
181186
}
182187
}
183188

184-
local gql_wrapper_1 = graphql.new({
189+
local gql_wrapper_1 = graphql.new(utils.merge_tables({
185190
schemas = schemas,
186191
collections = collections_1,
187192
service_fields = service_fields,
188193
indexes = indexes,
189-
accessor = 'space'
190-
})
194+
accessor = 'space',
195+
}, test_utils.test_conf_graphql_opts()))
191196

192197
test:isnt(gql_wrapper_1, nil)
193198

@@ -252,13 +257,13 @@ local collections_2 = json.decode([[{
252257
}
253258
}]])
254259

255-
local gql_wrapper_2 = graphql.new({
260+
local gql_wrapper_2 = graphql.new(utils.merge_tables({
256261
schemas = schemas,
257262
collections = collections_2,
258263
service_fields = service_fields,
259264
indexes = indexes,
260-
accessor = 'space'
261-
})
265+
accessor = 'space',
266+
}, test_utils.test_conf_graphql_opts()))
262267

263268
test:isnt(gql_wrapper_2, nil)
264269

@@ -336,13 +341,13 @@ local collections_3 = json.decode([[{
336341
}
337342
}]])
338343

339-
local gql_wrapper_3 = graphql.new({
344+
local gql_wrapper_3 = graphql.new(utils.merge_tables({
340345
schemas = schemas,
341346
collections = collections_3,
342347
service_fields = service_fields,
343348
indexes = indexes,
344-
accessor = 'space'
345-
})
349+
accessor = 'space',
350+
}, test_utils.test_conf_graphql_opts()))
346351
test:isnt(gql_wrapper_3, nil)
347352

348353
test:check()

test/extra/suite.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"*": {
3+
"dfs": {
4+
"graphql_opts": {
5+
"use_bfs_executor": "never"
6+
}
7+
},
8+
"bfs": {
9+
"graphql_opts": {
10+
"use_bfs_executor": "always"
11+
}
12+
}
13+
}
14+
}

test/extra/suite.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
core = app
33
description = tests on features which are not related to specific executor
44
is_parallel = True
5+
config = suite.cfg

test/extra/to_avro_arrays.test.lua

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
#!/usr/bin/env tarantool
2+
23
local fio = require('fio')
34
local yaml = require('yaml')
45
local avro = require('avro_schema')
5-
local test = require('tap').test('to avro schema')
6+
local tap = require('tap')
67

78
-- require in-repo version of graphql/ sources despite current working directory
89
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
910
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' ..
1011
package.path
1112

13+
local utils = require('graphql.utils')
14+
local graphql = require('graphql')
15+
local test_utils = require('test.test_utils')
1216
local testdata = require('test.testdata.array_and_map_testdata')
1317

14-
local graphql = require('graphql')
18+
local test = tap.test('to avro schema')
1519

1620
box.cfg{wal_mode="none"}
1721
test:plan(4)
@@ -20,18 +24,13 @@ testdata.init_spaces()
2024
testdata.fill_test_data()
2125
local meta = testdata.get_test_metadata()
2226

23-
local accessor = graphql.accessor_space.new({
27+
local gql_wrapper = graphql.new(utils.merge_tables({
2428
schemas = meta.schemas,
2529
collections = meta.collections,
26-
service_fields = meta.service_fields,
2730
indexes = meta.indexes,
28-
})
29-
30-
local gql_wrapper = graphql.new({
31-
schemas = meta.schemas,
32-
collections = meta.collections,
33-
accessor = accessor,
34-
})
31+
service_fields = meta.service_fields,
32+
accessor = 'space',
33+
}, test_utils.test_conf_graphql_opts()))
3534

3635
-- We do not select `customer_balances` and `favorite_holidays` because thay are
3736
-- is of `Map` type, which is not supported.

test/extra/to_avro_directives.test.lua

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
#!/usr/bin/env tarantool
2+
23
local fio = require('fio')
34
local yaml = require('yaml')
45
local avro = require('avro_schema')
5-
local test = require('tap').test('to avro schema')
6+
local tap = require('tap')
67

78
-- require in-repo version of graphql/ sources despite current working directory
89
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
9-
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
10+
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' ..
11+
package.path
1012

13+
local graphql = require('graphql')
14+
local utils = require('graphql.utils')
15+
local test_utils = require('test.test_utils')
1116
local common_testdata = require('test.testdata.common_testdata')
1217
local union_testdata = require('test.testdata.union_testdata')
1318
local multihead_testdata = require('test.testdata.multihead_conn_testdata')
14-
local graphql = require('graphql')
19+
20+
local test = tap.test('to avro schema')
1521

1622
test:plan(15)
1723

@@ -23,13 +29,13 @@ common_testdata.init_spaces()
2329
local common_meta = common_testdata.get_test_metadata()
2430
common_testdata.fill_test_data(box.space, common_meta)
2531

26-
local gql_wrapper = graphql.new({
32+
local gql_wrapper = graphql.new(utils.merge_tables({
2733
schemas = common_meta.schemas,
2834
collections = common_meta.collections,
2935
service_fields = common_meta.service_fields,
3036
indexes = common_meta.indexes,
3137
accessor = 'space'
32-
})
38+
}, test_utils.test_conf_graphql_opts()))
3339

3440
local common_query = [[
3541
query order_by_id($order_id: String, $include_description: Boolean,
@@ -187,13 +193,13 @@ union_testdata.init_spaces()
187193
local union_meta = union_testdata.get_test_metadata()
188194
union_testdata.fill_test_data(box.space, union_meta)
189195

190-
local gql_wrapper = graphql.new({
196+
local gql_wrapper = graphql.new(utils.merge_tables({
191197
schemas = union_meta.schemas,
192198
collections = union_meta.collections,
193199
service_fields = union_meta.service_fields,
194200
indexes = union_meta.indexes,
195201
accessor = 'space'
196-
})
202+
}, test_utils.test_conf_graphql_opts()))
197203

198204
local union_query = [[
199205
query user_collection ($include_stuff: Boolean) {
@@ -352,13 +358,13 @@ multihead_testdata.init_spaces()
352358
local multihead_meta = multihead_testdata.get_test_metadata()
353359
multihead_testdata.fill_test_data(box.space, multihead_meta)
354360

355-
local gql_wrapper = graphql.new({
361+
local gql_wrapper = graphql.new(utils.merge_tables({
356362
schemas = multihead_meta.schemas,
357363
collections = multihead_meta.collections,
358364
service_fields = multihead_meta.service_fields,
359365
indexes = multihead_meta.indexes,
360366
accessor = 'space'
361-
})
367+
}, test_utils.test_conf_graphql_opts()))
362368

363369
local multihead_query = [[
364370
query obtainHeroes($hero_id: String, $include_connections: Boolean) {

0 commit comments

Comments
 (0)