Skip to content

Commit 0158fcd

Browse files
committed
Add test to check error messages consistency
1 parent 355393e commit 0158fcd

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
### Changed
1313
* Make select error description more informative in case
14-
of disabled/uninit storage.
14+
of disabled/uninit storage (part of #229).
1515

1616
### Fixed
1717

test/integration/select_test.lua

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,3 +1690,43 @@ pgroup.test_storage_nil_err_is_processed = function(g)
16901690
t.assert_str_contains(err.str, 'StorageError', 'Storage error class is preserved')
16911691
t.assert_str_contains(err.str, 'My storage error', 'Storage error msg is preserved')
16921692
end
1693+
1694+
pgroup.before_test('test_storage_uninit_error_text', function(g)
1695+
helpers.call_on_storages(g.cluster, function(server)
1696+
server.net_box:eval([[
1697+
local _crud = rawget(_G, '_crud')
1698+
rawset(_G, '_real_crud_select', _crud.select_on_storage)
1699+
_crud.select_on_storage = nil
1700+
rawset(_G, '_real_crud_get', _crud.get_on_storage)
1701+
_crud.get_on_storage = nil
1702+
]])
1703+
end)
1704+
end)
1705+
1706+
pgroup.after_test('test_storage_uninit_error_text', function(g)
1707+
helpers.call_on_storages(g.cluster, function(server)
1708+
server.net_box:eval([[
1709+
local _crud = rawget(_G, '_crud')
1710+
_crud.select_on_storage = rawget(_G, '_real_crud_select')
1711+
rawset(_G, '_real_crud_select', nil)
1712+
_crud.get_on_storage = rawget(_G, '_real_crud_get')
1713+
rawset(_G, '_real_crud_get', nil)
1714+
]])
1715+
end)
1716+
end)
1717+
1718+
pgroup.test_storage_uninit_error_text = function(g)
1719+
local obj, err = g.cluster.main_server.net_box:call('crud.select', {
1720+
'customers', {{'==', 'age', 101}}
1721+
})
1722+
t.assert_equals(obj, nil)
1723+
t.assert_str_contains(err.str, 'SelectError')
1724+
t.assert_str_contains(err.str, 'NotInitialized')
1725+
t.assert_str_contains(err.str, "crud isn't initialized on replicaset")
1726+
1727+
obj, err = g.cluster.main_server.net_box:call('crud.get', {'customers', 1})
1728+
t.assert_equals(obj, nil)
1729+
t.assert_str_contains(err.str, 'GetError')
1730+
t.assert_str_contains(err.str, 'NotInitialized')
1731+
t.assert_str_contains(err.str, "crud isn't initialized on replicaset")
1732+
end

0 commit comments

Comments
 (0)