Skip to content

Commit 0c8810e

Browse files
authored
Update luatest to 0.5.4 (#1515)
Tests are updated accordingly.
1 parent fdbae9b commit 0c8810e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+594
-543
lines changed

.github/workflows/backend-test.yml

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ env:
1515

1616
jobs:
1717
misc:
18-
strategy:
19-
fail-fast: false
20-
matrix:
21-
runs-on: [ubuntu-18.04]
22-
runs-on: ${{ matrix.runs-on }}
18+
runs-on: ubuntu-18.04
2319
steps:
2420
- uses: actions/checkout@v2
2521
- uses: actions/setup-node@v1
@@ -28,15 +24,15 @@ jobs:
2824
# Setup sphinx
2925
- name: Cache pip packages
3026
uses: actions/cache@v2
31-
id: cache-misc-venv
27+
id: cache-venv
3228
with:
3329
path: ./venv
34-
key: cache-misc-venv-${{ matrix.runs-on }}-${{ hashFiles('rst/requirements.txt') }}-06
30+
key: misc-venv-${{ hashFiles('rst/requirements.txt') }}-02
3531
-
3632
run: |
3733
python -m venv ./venv && . ./venv/bin/activate
3834
pip install -r rst/requirements.txt
39-
if: steps.cache-misc-venv.outputs.cache-hit != 'true'
35+
if: steps.cache-venv.outputs.cache-hit != 'true'
4036

4137
# Setup tarantool
4238
- uses: tarantool/setup-tarantool@v1
@@ -46,28 +42,26 @@ jobs:
4642
# Setup luacheck and ldoc
4743
- name: Cache rocks
4844
uses: actions/cache@v2
49-
id: cache-misc-rocks
45+
id: cache-rocks
5046
with:
5147
path: .rocks/
52-
key: cache-misc-rocks-${{ matrix.runs-on }}-${{ hashFiles('cartridge-scm-1.rockspec') }}
53-
restore-keys: cache-misc-rocks-${{ matrix.runs-on }}
48+
key: misc-rocks-${{ hashFiles('*.rockspec') }}-02
5449
-
55-
run: tarantoolctl rocks install luacheck
56-
if: steps.cache-misc-rocks.outputs.cache-hit != 'true'
57-
-
58-
run: tarantoolctl rocks install ldoc --server=https://tarantool.github.io/LDoc/
59-
if: steps.cache-misc-rocks.outputs.cache-hit != 'true'
50+
run: |
51+
tarantoolctl rocks install luacheck
52+
tarantoolctl rocks install ldoc --server=https://tarantool.github.io/LDoc/
53+
if: steps.cache-rocks.outputs.cache-hit != 'true'
6054

6155
# Setup graphql cli
6256
- name: Cache npm
6357
uses: actions/cache@v2
64-
id: cache-misc-npm
58+
id: cache-npm
6559
with:
6660
path: node_modules
67-
key: cache-misc-npm-01
61+
key: npm-02
6862
-
6963
run: npm install [email protected]
70-
if: steps.cache-misc-npm.outputs.cache-hit != 'true'
64+
if: steps.cache-npm.outputs.cache-hit != 'true'
7165

7266
# Run tests
7367
- run: .rocks/bin/luacheck .
@@ -88,9 +82,8 @@ jobs:
8882
strategy:
8983
fail-fast: false
9084
matrix:
91-
runs-on: [ubuntu-18.04]
92-
tarantool: ['1.10']
93-
runs-on: ${{ matrix.runs-on }}
85+
tarantool: ['1.10', '2.7', '2.8', '2.9']
86+
runs-on: ubuntu-18.04
9487
steps:
9588
- uses: actions/setup-python@v2
9689
- uses: actions/checkout@v2
@@ -109,22 +102,21 @@ jobs:
109102
# Setup luatest
110103
- name: Cache rocks
111104
uses: actions/cache@v2
112-
id: cache-luatest-rocks
105+
id: cache-rocks
113106
with:
114107
path: .rocks/
115-
key: cache-luatest-rocks-${{ matrix.runs-on }}-${{ hashFiles('cartridge-scm-1.rockspec') }}
116-
restore-keys: cache-luatest-rocks-${{ matrix.runs-on }}
108+
key: test-rocks-${{ hashFiles('*.rockspec') }}-02
117109
-
118-
run: tarantoolctl rocks install luatest 0.5.2
119-
if: steps.cache-luatest-rocks.outputs.cache-hit != 'true'
110+
run: tarantoolctl rocks install luatest 0.5.4
111+
if: steps.cache-rocks.outputs.cache-hit != 'true'
120112

121113
# Setup pytest
122114
- name: Cache pytest
123115
uses: actions/cache@v2
124116
id: cache-pytest
125117
with:
126118
path: ./pytest-venv
127-
key: cache-pytest-venv-${{ matrix.runs-on }}-${{ hashFiles('test/integration/requirements.txt') }}-06
119+
key: test-venv-${{ hashFiles('test/integration/requirements.txt') }}-02
128120
-
129121
run: |
130122
python -m venv ./pytest-venv && . ./pytest-venv/bin/activate

.github/workflows/compatibility-test.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
runs-on: [ubuntu-18.04]
2019
tarantool: ['1.10']
2120
cartridge: ['1.2.0', '2.3.0', '2.4.0']
22-
runs-on: ${{ matrix.runs-on }}
21+
runs-on: ubuntu-18.04
2322
env:
2423
CARTRIDGE_OLDER_PATH: cartridge-${{ matrix.cartridge }}
2524
CARTRIDGE_OLDER_VERSION: ${{ matrix.cartridge }}-1
@@ -35,7 +34,7 @@ jobs:
3534
uses: actions/cache@v2
3635
with:
3736
path: ${{ env.CARTRIDGE_OLDER_PATH }}
38-
key: cache-${{ env.CARTRIDGE_OLDER_PATH }}-${{ matrix.runs-on }}
37+
key: ${{ env.CARTRIDGE_OLDER_PATH }}
3938
- name: Install ${{ env.CARTRIDGE_OLDER_PATH }}
4039
if: steps.cache-older-cartridge.outputs.cache-hit != 'true'
4140
run: |
@@ -47,14 +46,13 @@ jobs:
4746
# Setup luatest
4847
- name: Cache rocks
4948
uses: actions/cache@v2
50-
id: cache-compatibility-rocks
49+
id: cache-rocks
5150
with:
5251
path: .rocks/
53-
key: cache-compatibility-rocks-${{ matrix.runs-on }}-${{ hashFiles('cartridge-scm-1.rockspec') }}
54-
restore-keys: cache-compatibility-rocks-${{ matrix.runs-on }}
52+
key: compat-rocks-${{ hashFiles('*.rockspec') }}-02
5553
-
56-
run: tarantoolctl rocks install luatest 0.5.2
57-
if: steps.cache-compatibility-rocks.outputs.cache-hit != 'true'
54+
run: tarantoolctl rocks install luatest 0.5.4
55+
if: steps.cache-rocks.outputs.cache-hit != 'true'
5856

5957
- run: tarantoolctl rocks make
6058
- run: .rocks/bin/luatest -v -p compatibility.*

.github/workflows/frontend-test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ jobs:
4444
id: cache-rocks
4545
with:
4646
path: .rocks/
47-
key: rocks-${{ hashFiles('cartridge-scm-1.rockspec') }}
48-
restore-keys: rocks
47+
key: webui-rocks-${{ hashFiles('*.rockspec') }}-02
4948
-
50-
run: tarantoolctl rocks install luatest 0.5.2
49+
run: tarantoolctl rocks install luatest 0.5.4
5150
if: steps.cache-rocks.outputs.cache-hit != 'true'
5251

5352
##################################################################
@@ -79,7 +78,7 @@ jobs:
7978
path: |
8079
./node_modules
8180
~/.cache/Cypress
82-
key: cypress-cache-7.7.0-${{ runner.os }}-1
81+
key: cypress-7.7.0-${{ runner.os }}-02
8382
-
8483
run: |
8584
npm install [email protected]

.github/workflows/nightly-test.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
runs-on: [ubuntu-18.04]
2019
tarantool: ['1.10', '2.7', '2.8', '2.9']
21-
runs-on: ${{ matrix.runs-on }}
20+
runs-on: ubuntu-18.04
2221
steps:
2322
- uses: actions/checkout@v2
2423
- uses: tarantool/setup-tarantool@v1
@@ -37,14 +36,13 @@ jobs:
3736
# Setup luatest
3837
- name: Cache rocks
3938
uses: actions/cache@v2
40-
id: cache-luatest-rocks
39+
id: cache-rocks
4140
with:
4241
path: .rocks/
43-
key: cache-luatest-rocks-${{ matrix.runs-on }}-${{ hashFiles('cartridge-scm-1.rockspec') }}
44-
restore-keys: cache-luatest-rocks-${{ matrix.runs-on }}
42+
key: nightly-rocks-${{ hashFiles('*.rockspec') }}-02
4543
-
46-
run: tarantoolctl rocks install luatest 0.5.2
47-
if: steps.cache-luatest-rocks.outputs.cache-hit != 'true'
44+
run: tarantoolctl rocks install luatest 0.5.4
45+
if: steps.cache-rocks.outputs.cache-hit != 'true'
4846

4947
- run: tarantoolctl rocks make
5048
- run: .rocks/bin/luatest -v

cartridge/test-helpers/server.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Server.constructor_checks = fun.chain(Server.constructor_checks, {
3434
cluster_cookie = 'string',
3535

3636
advertise_port = 'number',
37+
advertise_uri = '?string',
3738

3839
instance_uuid = '?string',
3940
replicaset_uuid = '?string',
@@ -44,7 +45,7 @@ Server.constructor_checks = fun.chain(Server.constructor_checks, {
4445
function Server:initialize()
4546
self.net_box_port = self.net_box_port or self.advertise_port
4647
self.net_box_uri = 'localhost:' .. self.net_box_port
47-
self.advertise_uri = self.net_box_uri
48+
self.advertise_uri = self.advertise_uri or self.net_box_uri
4849
self.net_box_credentials = self.net_box_credentials or {
4950
user = 'admin',
5051
password = self.cluster_cookie,

test/integration/advertise_change_test.lua

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ local g = t.group()
55

66
local helpers = require('test.helper')
77

8-
local function move(srv, uri)
9-
srv.env['TARANTOOL_ADVERTISE_URI'] = uri
10-
srv.net_box_uri = uri
8+
local function move(srv, port)
9+
srv.net_box_port = nil
10+
srv.advertise_uri = nil
11+
srv.advertise_port = port
1112
end
1213

1314
g.before_all(function()
@@ -42,18 +43,18 @@ g.before_all(function()
4243
g.B1 = g.cluster:server('B-1')
4344
g.B2 = g.cluster:server('B-2')
4445

45-
g.cluster.main_server.net_box:call(
46+
g.cluster.main_server:call(
4647
'package.loaded.cartridge.failover_set_params',
4748
{{failover_timeout = 0}}
4849
)
4950

5051
fun.foreach(function(s) s:stop() end, g.cluster.servers)
51-
move(g.A1, 'localhost:13311')
52-
move(g.B1, 'localhost:13312')
52+
move(g.A1, 13311)
53+
move(g.B1, 13312)
5354
fun.foreach(function(s) s:start() end, g.cluster.servers)
5455

5556
helpers.retrying({}, function()
56-
g.cluster.main_server.net_box:eval([[
57+
g.cluster.main_server:eval([[
5758
local m = require('membership')
5859
assert(m.get_member('localhost:13301').status == 'dead')
5960
assert(m.get_member('localhost:13302').status == 'dead')
@@ -125,20 +126,22 @@ function g.test_suggestion()
125126
}})
126127
end
127128

128-
function g.test_2pc()
129-
local query = [[ mutation($servers: [EditServerInput]) {
130-
cluster{ edit_topology(servers: $servers){ servers { uri } } }
129+
g.before_test('test_2pc', function()
130+
g.query = [[ mutation($servers: [EditServerInput]) {
131+
cluster{ edit_topology(servers: $servers){ servers { uri } } }
131132
}]]
133+
end)
132134

135+
function g.test_2pc()
133136
g.cluster.main_server:graphql({
134-
query = query,
137+
query = g.query,
135138
variables = {servers = {
136139
{uuid = g.A1.instance_uuid, uri = g.A1.net_box_uri},
137140
}},
138141
})
139142

140143
g.cluster.main_server:graphql({
141-
query = query,
144+
query = g.query,
142145
variables = {servers = {
143146
{uuid = g.B1.instance_uuid, uri = g.B1.net_box_uri},
144147
}},
@@ -154,26 +157,30 @@ function g.test_2pc()
154157
restart_replication = box.NULL,
155158
})
156159
end)
160+
end
157161

162+
g.after_test('test_2pc', function()
158163
g.cluster.main_server:graphql({
159-
query = query,
164+
query = g.query,
160165
variables = {servers = {
161166
{uuid = g.A1.instance_uuid, uri = 'localhost:13301'},
162167
{uuid = g.B1.instance_uuid, uri = 'localhost:13302'},
163168
}},
164169
})
165-
end
166-
167-
function g.test_failover()
168-
-- Test for https://github.com/tarantool/cartridge/issues/1029
170+
g.query = nil
171+
end)
169172

170-
local ok, err = g.A1.net_box:call(
173+
g.before_test('test_failover', function()
174+
local ok, err = g.A1:call(
171175
'package.loaded.cartridge.failover_set_params',
172176
{{mode = 'eventual'}}
173177
)
174178
t.assert_equals({ok, err}, {true, nil})
179+
end)
175180

176-
local ok, err = g.B1.net_box:call(
181+
function g.test_failover()
182+
-- Test for https://github.com/tarantool/cartridge/issues/1029
183+
local ok, err = g.B1:call(
177184
'package.loaded.cartridge.admin_probe_server',
178185
{g.B2.advertise_uri}
179186
)
@@ -195,10 +202,12 @@ function g.test_failover()
195202
uuid = g.B2.instance_uuid,
196203
boxinfo = {general = {listen = '13303', ro = false}},
197204
}})
205+
end
198206

199-
local ok, err = g.A1.net_box:call(
207+
g.after_test('test_failover', function()
208+
local ok, err = g.A1:call(
200209
'package.loaded.cartridge.failover_set_params',
201210
{{mode = 'disabled'}}
202211
)
203212
t.assert_equals({ok, err}, {true, nil})
204-
end
213+
end)

test/integration/api_join_test.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function g.test_join_server()
6767
t.assert_equals(resp['data']['probe_server'], true)
6868

6969
local function get_peer_uuid(uri)
70-
return main.net_box:eval([[
70+
return main:eval([[
7171
local errors = require('errors')
7272
local pool = require('cartridge.pool')
7373
local conn, err = errors.assert('E', pool.connect(...))
@@ -164,7 +164,7 @@ function g.test_join_server()
164164
end)
165165

166166
t.helpers.retrying({timeout = 5, delay = 0.1}, function()
167-
main.net_box:eval([[
167+
main:eval([[
168168
local cartridge = package.loaded['cartridge']
169169
return assert(cartridge) and assert(cartridge.is_healthy())
170170
]])

0 commit comments

Comments
 (0)