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

Commit 1d7e8b2

Browse files
committed
WIP: Test DFS and BFS executors both
For now only for common suite.
1 parent 0999b38 commit 1d7e8b2

File tree

4 files changed

+217
-24
lines changed

4 files changed

+217
-24
lines changed

test/common/limit_result.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_limit_to = test_run and test_run:get_cfg('apply_limit_to') or
2020
'graphql'
21-
local settings = {
21+
local test_graphql_opts = {
2222
resulting_object_cnt_max = 3,
2323
fetched_object_cnt_max = 5,
2424
}
@@ -42,7 +42,7 @@ local function run_queries(gql_wrapper)
4242
}
4343
]]
4444

45-
local query_opts = apply_settings_to == 'query' and settings or nil
45+
local query_opts = apply_limit_to == 'query' and test_graphql_opts or nil
4646
local gql_query = gql_wrapper:compile(query, query_opts)
4747
local variables = {
4848
user_id = 5,
@@ -76,7 +76,7 @@ end
7676

7777
box.cfg({})
7878

79-
local graphql_opts = apply_settings_to == 'graphql' and settings or nil
79+
local graphql_opts = apply_limit_to == 'graphql' and test_graphql_opts or nil
8080
test_utils.run_testdata(testdata, {
8181
run_queries = run_queries,
8282
graphql_opts = graphql_opts,

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: 204 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,212 @@
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
"limit_result.test.lua": {
11-
"space (g)": {"conf": "space", "apply_settings_to": "graphql"},
12-
"shard_2x2 (g)": {"conf": "shard_2x2", "apply_settings_to": "graphql"},
13-
"shard_4x1 (g)": {"conf": "shard_4x1", "apply_settings_to": "graphql"},
14-
"space (q)": {"conf": "space", "apply_settings_to": "query"},
15-
"shard_2x2 (q)": {"conf": "shard_2x2", "apply_settings_to": "query"},
16-
"shard_4x1 (q)": {"conf": "shard_4x1", "apply_settings_to": "query"}
89+
"space (dfs, g)": {
90+
"conf": "space",
91+
"apply_limit_to": "graphql",
92+
"graphql_opts": {
93+
"use_bfs_executor": "never"
94+
}
95+
},
96+
"space (bfs, g)": {
97+
"conf": "space",
98+
"apply_limit_to": "graphql",
99+
"graphql_opts": {
100+
"use_bfs_executor": "always"
101+
}
102+
},
103+
"shard_2x2 (dfs, g)": {
104+
"conf": "shard_2x2",
105+
"apply_limit_to": "graphql",
106+
"graphql_opts": {
107+
"use_bfs_executor": "never"
108+
}
109+
},
110+
"shard_2x2 (bfs, g)": {
111+
"conf": "shard_2x2",
112+
"apply_limit_to": "graphql",
113+
"graphql_opts": {
114+
"use_bfs_executor": "always"
115+
}
116+
},
117+
"shard_4x1 (dfs, g)": {
118+
"conf": "shard_4x1",
119+
"apply_limit_to": "graphql",
120+
"graphql_opts": {
121+
"use_bfs_executor": "never"
122+
}
123+
},
124+
"shard_4x1 (bfs, g)": {
125+
"conf": "shard_4x1",
126+
"apply_limit_to": "graphql",
127+
"graphql_opts": {
128+
"use_bfs_executor": "always"
129+
}
130+
},
131+
"space (dfs, q)": {
132+
"conf": "space",
133+
"apply_limit_to": "query",
134+
"graphql_opts": {
135+
"use_bfs_executor": "never"
136+
}
137+
},
138+
"space (bfs, q)": {
139+
"conf": "space",
140+
"apply_limit_to": "query",
141+
"graphql_opts": {
142+
"use_bfs_executor": "always"
143+
}
144+
},
145+
"shard_2x2 (dfs, q)": {
146+
"conf": "shard_2x2",
147+
"apply_limit_to": "query",
148+
"graphql_opts": {
149+
"use_bfs_executor": "never"
150+
}
151+
},
152+
"shard_2x2 (bfs, q)": {
153+
"conf": "shard_2x2",
154+
"apply_limit_to": "query",
155+
"graphql_opts": {
156+
"use_bfs_executor": "always"
157+
}
158+
},
159+
"shard_4x1 (dfs, q)": {
160+
"conf": "shard_4x1",
161+
"apply_limit_to": "query",
162+
"graphql_opts": {
163+
"use_bfs_executor": "never"
164+
}
165+
},
166+
"shard_4x1 (bfs, q)": {
167+
"conf": "shard_4x1",
168+
"apply_limit_to": "query",
169+
"graphql_opts": {
170+
"use_bfs_executor": "always"
171+
}
172+
}
17173
},
18174
"*": {
19-
"space": {"conf": "space"},
20-
"shard_2x2": {"conf": "shard_2x2"},
21-
"shard_4x1": {"conf": "shard_4x1"}
175+
"space (dfs)": {
176+
"conf": "space",
177+
"graphql_opts": {
178+
"use_bfs_executor": "never"
179+
}
180+
},
181+
"space (bfs)": {
182+
"conf": "space",
183+
"graphql_opts": {
184+
"use_bfs_executor": "always"
185+
}
186+
},
187+
"shard_2x2 (dfs)": {
188+
"conf": "shard_2x2",
189+
"graphql_opts": {
190+
"use_bfs_executor": "never"
191+
}
192+
},
193+
"shard_2x2 (bfs)": {
194+
"conf": "shard_2x2",
195+
"graphql_opts": {
196+
"use_bfs_executor": "always"
197+
}
198+
},
199+
"shard_4x1 (dfs)": {
200+
"conf": "shard_4x1",
201+
"graphql_opts": {
202+
"use_bfs_executor": "never"
203+
}
204+
},
205+
"shard_4x1 (bfs)": {
206+
"conf": "shard_4x1",
207+
"graphql_opts": {
208+
"use_bfs_executor": "always"
209+
}
210+
}
22211
}
23212
}

test/test_utils.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ function test_utils.graphql_from_testdata(testdata, shard, graphql_opts)
113113
accessor = shard and 'shard' or 'space',
114114
}
115115

116+
-- allow to run under tarantool w/o additional opts w/o test-run
117+
local test_conf_graphql_opts = test_run and test_run:get_cfg('graphql_opts')
118+
or {}
119+
116120
local gql_wrapper = graphql.new(utils.merge_tables(
117-
default_graphql_opts, graphql_opts))
121+
default_graphql_opts, test_conf_graphql_opts, graphql_opts))
118122

119123
return gql_wrapper
120124
end

0 commit comments

Comments
 (0)