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

Commit 7b559b5

Browse files
committed
WIP: Fix & refactor 'common' test
1 parent c8c13ec commit 7b559b5

15 files changed

+351
-797
lines changed

test/bench/bench.lua

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ local clock = require('clock')
1313
local fiber = require('fiber')
1414
local digest = require('digest')
1515
local multirunner = require('test.common.lua.multirunner')
16-
local graphql = require('graphql')
1716
local utils = require('graphql.utils')
1817
local test_run = utils.optional_require('test_run')
1918
test_run = test_run and test_run.new()
@@ -29,29 +28,6 @@ local SCRIPT_DIR = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
2928

3029
local bench = {}
3130

32-
function bench.graphql_from_testdata(testdata, shard)
33-
local accessor_class = shard and graphql.accessor_shard or
34-
graphql.accessor_space
35-
36-
local meta = testdata.get_test_metadata()
37-
38-
local accessor = accessor_class.new({
39-
schemas = meta.schemas,
40-
collections = meta.collections,
41-
service_fields = meta.service_fields,
42-
indexes = meta.indexes,
43-
timeout_ms = graphql.TIMEOUT_INFINITY,
44-
})
45-
46-
local gql_wrapper = graphql.new({
47-
schemas = meta.schemas,
48-
collections = meta.collections,
49-
accessor = accessor,
50-
})
51-
52-
return gql_wrapper
53-
end
54-
5531
local function workload(shard, bench_prepare, bench_iter, opts)
5632
local iterations = opts.iterations
5733
local exp_checksum = opts.checksum

test/bench/nesting-1-1.test.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local fio = require('fio')
99
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
1010
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
1111

12+
local utils = require('test.utils')
1213
local bench = require('test.bench.bench')
1314
local testdata = require('test.testdata.bench_testdata')
1415

@@ -18,7 +19,7 @@ local testdata = require('test.testdata.bench_testdata')
1819
local function bench_prepare(state)
1920
local virtbox = state.shard or box.space
2021

21-
state.gql_wrapper = bench.graphql_from_testdata(testdata, state.shard)
22+
state.gql_wrapper = utils.graphql_from_testdata(testdata, state.shard)
2223
testdata.fill_test_data(virtbox)
2324

2425
local query = [[

test/bench/nesting-1-100.test.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local fio = require('fio')
99
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
1010
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
1111

12+
local utils = require('test.utils')
1213
local bench = require('test.bench.bench')
1314
local testdata = require('test.testdata.bench_testdata')
1415

@@ -18,7 +19,7 @@ local testdata = require('test.testdata.bench_testdata')
1819
local function bench_prepare(state)
1920
local virtbox = state.shard or box.space
2021

21-
state.gql_wrapper = bench.graphql_from_testdata(testdata, state.shard)
22+
state.gql_wrapper = utils.graphql_from_testdata(testdata, state.shard)
2223
testdata.fill_test_data(virtbox)
2324

2425
local query = [[

test/bench/nesting-2-1-1.test.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local fio = require('fio')
99
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
1010
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
1111

12+
local utils = require('test.utils')
1213
local bench = require('test.bench.bench')
1314
local testdata = require('test.testdata.bench_testdata')
1415

@@ -18,7 +19,7 @@ local testdata = require('test.testdata.bench_testdata')
1819
local function bench_prepare(state)
1920
local virtbox = state.shard or box.space
2021

21-
state.gql_wrapper = bench.graphql_from_testdata(testdata, state.shard)
22+
state.gql_wrapper = utils.graphql_from_testdata(testdata, state.shard)
2223
testdata.fill_test_data(virtbox)
2324

2425
local query = [[

test/bench/nesting-2-100-1.test.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local fio = require('fio')
99
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
1010
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
1111

12+
local utils = require('test.utils')
1213
local bench = require('test.bench.bench')
1314
local testdata = require('test.testdata.bench_testdata')
1415

@@ -18,7 +19,7 @@ local testdata = require('test.testdata.bench_testdata')
1819
local function bench_prepare(state)
1920
local virtbox = state.shard or box.space
2021

21-
state.gql_wrapper = bench.graphql_from_testdata(testdata, state.shard)
22+
state.gql_wrapper = utils.graphql_from_testdata(testdata, state.shard)
2223
testdata.fill_test_data(virtbox)
2324

2425
local query = [[

test/bench/nesting-3-1-1-1.test.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local fio = require('fio')
99
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
1010
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
1111

12+
local utils = require('test.utils')
1213
local bench = require('test.bench.bench')
1314
local testdata = require('test.testdata.bench_testdata')
1415

@@ -18,7 +19,7 @@ local testdata = require('test.testdata.bench_testdata')
1819
local function bench_prepare(state)
1920
local virtbox = state.shard or box.space
2021

21-
state.gql_wrapper = bench.graphql_from_testdata(testdata, state.shard)
22+
state.gql_wrapper = utils.graphql_from_testdata(testdata, state.shard)
2223
testdata.fill_test_data(virtbox)
2324

2425
local query = [[

test/bench/nesting-3-100-100-1.test.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local fio = require('fio')
99
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
1010
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
1111

12+
local utils = require('test.utils')
1213
local bench = require('test.bench.bench')
1314
local testdata = require('test.testdata.bench_testdata')
1415

@@ -18,7 +19,7 @@ local testdata = require('test.testdata.bench_testdata')
1819
local function bench_prepare(state)
1920
local virtbox = state.shard or box.space
2021

21-
state.gql_wrapper = bench.graphql_from_testdata(testdata, state.shard)
22+
state.gql_wrapper = utils.graphql_from_testdata(testdata, state.shard)
2223
testdata.fill_test_data(virtbox)
2324

2425
local query = [[

test/local/space_common.result

Lines changed: 0 additions & 232 deletions
This file was deleted.

0 commit comments

Comments
 (0)