Skip to content

Commit

Permalink
Update errors module (#1322)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosik authored Mar 18, 2021
1 parent 67589e8 commit 29137d6
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 35 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ and this project adheres to
Added
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Issues and suggestions:

- Extend GraphQL ``issues`` API with ``aliens`` topic. The issues warns if
two separate clusters share the same cluster cookie.

- Enhance error messages when they're transferred over network. Supply it
with the connection URI.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ add_custom_command(
VERBATIM
)

if(LDOC_FOUND AND SPHINX_FOUND)
if(Ldoc_FOUND AND Sphinx_FOUND)
add_custom_target(doc ALL
DEPENDS "${DOC_OUTPUT}/index.html")
else()
Expand Down
2 changes: 1 addition & 1 deletion cartridge-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = {
'ddl == 1.3.0-1',
'http == 1.1.0-1',
'checks == 3.1.0-1',
'errors == 2.1.4-1',
'errors == 2.1.5-1',
'vshard == 0.1.16-1',
'membership == 2.3.1-1',
'frontend-core == 7.5.0-1',
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindLdoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ find_program(LDOC ldoc
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LDOC
find_package_handle_standard_args(Ldoc
REQUIRED_VARS LDOC
)

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindSphinx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ find_program(SPHINX sphinx-build
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SPHINX
find_package_handle_standard_args(Sphinx
REQUIRED_VARS SPHINX
)

Expand Down
2 changes: 1 addition & 1 deletion test/integration/api_join_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function g.test_join_server()
)

t.assert_error_msg_equals(
[[Missing localhost:13302 in clusterwide config,]] ..
[["127.0.0.1:13302": Missing localhost:13302 in clusterwide config,]] ..
[[ check advertise_uri correctness]],
function()
return main:graphql({
Expand Down
2 changes: 1 addition & 1 deletion test/integration/api_query_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ function g.test_operation_error()
})

local err = resp.errors[1]
t.assert_covers(err, {message = 'Artificial Error'})
t.assert_covers(err, {message = '"localhost:13304": Artificial Error'})
t.assert_covers(err.extensions, {
['io.tarantool.errors.class_name'] = 'ApplyConfigError',
})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/api_uninitialized_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function g.test_uninitialized()

-- edit_topology message slightly differs from join_server
t.assert_error_msg_equals(
[[Missing localhost:13301 in clusterwide config,]] ..
[["127.0.0.1:13301": Missing localhost:13301 in clusterwide config,]] ..
[[ check advertise_uri correctness]],
function()
return g.server:graphql({query = [[
Expand Down
2 changes: 1 addition & 1 deletion test/integration/ddl_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function g.test_luaapi()

t.assert_equals(
{call('cartridge_set_schema', {'{}'})},
{box.NULL, 'spaces: must be a table, got nil'}
{box.NULL, '"localhost:13302": spaces: must be a table, got nil'}
)

t.assert_equals(
Expand Down
6 changes: 3 additions & 3 deletions test/integration/failover_stateful_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -422,22 +422,22 @@ add('test_leader_promote', function(g)
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'AppointmentError',
err = [[Server "invalid_uuid" doesn't exist]],
err = [["localhost:13301": Server "invalid_uuid" doesn't exist]],
})

local ok, err = S1.net_box:eval(q_promote, {{['invalid_uuid'] = storage_1_uuid}})
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'AppointmentError',
err = [[Replicaset "invalid_uuid" doesn't exist]],
err = [["localhost:13301": Replicaset "invalid_uuid" doesn't exist]],
})

local ok, err = S1.net_box:eval(q_promote, {{[router_uuid] = storage_1_uuid}})
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'AppointmentError',
err = string.format(
[[Server %q doesn't belong to replicaset %q]],
[["localhost:13301": Server %q doesn't belong to replicaset %q]],
storage_1_uuid, router_uuid
),
})
Expand Down
4 changes: 2 additions & 2 deletions test/integration/force_reapply_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function g.test_twophase_config_locked()
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'Prepare2pcError',
err = 'Two-phase commit is locked',
err = '"localhost:13302": Two-phase commit is locked',
})

-- But force reapply comes to the rescue!
Expand Down Expand Up @@ -154,7 +154,7 @@ function g.test_suggestions()
end
]])
t.assert_error_msg_equals(
'Artificial Error',
'"localhost:13303": Artificial Error',
force_reapply, {g.A3.instance_uuid}
)

Expand Down
8 changes: 4 additions & 4 deletions test/integration/pool_map_call_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function g.test_timeout()

t.assert_equals(retmap, {})
assert_err_equals(errmap, 'localhost:13301',
'NetboxCallError: Timeout exceeded'
'NetboxCallError: "localhost:13301": Timeout exceeded'
)
end

Expand Down Expand Up @@ -185,8 +185,8 @@ function g.test_negative()

t.assert_equals(retmap, {})
assert_err_equals(errmap, '!@#$%^&*()', 'FormatURIError: Invalid URI "!@#$%^&*()"')
assert_err_equals(errmap, 'localhost:13301', 'NetboxCallError: Too long WAL write')
assert_err_equals(errmap, 'localhost:13302', 'NetboxCallError: Too long WAL write')
assert_err_equals(errmap, 'localhost:13301', 'NetboxCallError: "localhost:13301": Too long WAL write')
assert_err_equals(errmap, 'localhost:13302', 'NetboxCallError: "localhost:13302": Too long WAL write')
assert_err_equals(errmap, 'localhost:13309', 'NetboxConnectError: "localhost:13309": Invalid greeting')
assert_err_equals(errmap, 'localhost:9',
'NetboxConnectError: "localhost:9": ' .. errno.strerror(errno.ECONNREFUSED),
Expand Down Expand Up @@ -221,7 +221,7 @@ function g.test_errors_united()
err.err:split('\n'),
{
'Invalid URI ")(*&^%$#@!"',
'Segmentation fault',
'"localhost:13302": Segmentation fault',
'"localhost:13309": Invalid greeting',
}
)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/proxy_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function g.test_dead_destination()
uri = g.unconfigured.advertise_uri,
}}
}}).errors[1],
{message = 'Connection refused'}
{message = '"localhost:13301": Connection refused'}
)
end

Expand Down
9 changes: 6 additions & 3 deletions test/integration/rpc_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ function g.test_api()
t.assert_not(err)
t.assert_equals(res, 'initialized')

local res, err = rpc_call(server, 'myrole', 'fn_undefined')
local res, err = rpc_call(server, 'myrole',
'fn_undefined', nil,
{uri = "127.0.0.1:13303"}
)
t.assert_not(res)
t.assert_covers(err, {
class_name = 'RemoteCallError',
err = 'Role "myrole" has no method "fn_undefined"'
err = '"127.0.0.1:13303": Role "myrole" has no method "fn_undefined"'
})

local res, err = rpc_call(server, 'unknown-role', 'fn_undefined')
Expand All @@ -85,7 +88,7 @@ function g.test_errors()
t.assert_not(res)
t.assert_covers(err, {
class_name = 'RemoteCallError',
err = 'Boo',
err = '"localhost:13302": Boo',
})
t.assert_str_contains(err.stack, 'during net.box call to localhost:13302')

Expand Down
4 changes: 2 additions & 2 deletions test/integration/state_machine_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function g.test_leader_death()

-- Trigger patch_clusterwide
t.assert_error_msg_equals(
"Apply fails sometimes, who'd have thought?",
[["localhost:13301": Apply fails sometimes, who'd have thought?]],
function()
return g.master:graphql({query = [[
mutation{ cluster{
Expand Down Expand Up @@ -679,7 +679,7 @@ function g.test_operation_error()
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'ApplyConfigError',
err = 'Artificial Error',
err = '"localhost:13302": Artificial Error',
})

local ok, err = g.master.net_box:eval(set_roles, {uA, {}})
Expand Down
8 changes: 4 additions & 4 deletions test/integration/stateboard_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ function g.test_appointments()
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'NetboxCallError',
err = "Duplicate key exists in unique index 'ordinal'" ..
" in space 'leader_audit'"
err = '"localhost:13301": Duplicate key exists' ..
" in unique index 'ordinal' in space 'leader_audit'"
})
end

Expand Down Expand Up @@ -264,7 +264,7 @@ function g.test_client_session()
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'NetboxCallError',
err = 'Peer closed',
err = '"localhost:13301": Peer closed',
})
t.assert_is_not(client:get_session(), session)

Expand All @@ -291,7 +291,7 @@ function g.test_client_drop_session()
t.assert_equals(ok, nil)
t.assert_covers(err, {
class_name = 'NetboxCallError',
err = 'Connection closed',
err = '"localhost:13301": Connection closed',
})

-- dropping session releases lock and make it dead
Expand Down
4 changes: 2 additions & 2 deletions test/integration/switchover_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ add('test_enabling', function(g)
g.name == 'integration.switchover.etcd2' and
g.state_provider.client_url .. "/v2/members:" ..
" Couldn't connect to server" or
"Connection refused"),
'"127.0.0.1:14401": Connection refused'),
}, {
level = "warning",
topic = "switchover",
Expand Down Expand Up @@ -675,7 +675,7 @@ add('test_api', function(g)

-- Consistent promotion fails because the keeper is still "nobody"
t.assert_error_msg_equals(
'timed out',
'"localhost:13303": timed out',
A1.graphql, A1, {
query = query,
variables = {
Expand Down
6 changes: 3 additions & 3 deletions test/integration/upload_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function g.test_begining_failure()
t.assert_equals(res, nil)
t.assert_covers(err, {
class_name = 'NetboxCallError',
err = 'Timeout exceeded',
err = '"localhost:13302": Timeout exceeded',
})

-- prefix should be cleaned up even if upload_begin fails
Expand Down Expand Up @@ -102,7 +102,7 @@ function g.test_transmission_failure()
t.assert_equals(res, nil)
t.assert_covers(err, {
class_name = 'NetboxCallError',
err = 'Artificial transmission failure',
err = '"localhost:13303": Artificial transmission failure',
})

-- prefix should be cleaned up even if upload_transmit fails
Expand Down Expand Up @@ -145,7 +145,7 @@ function g.test_finish_failure()
t.assert_equals(res, nil)
t.assert_covers(err, {
class_name = 'Prepare2pcError',
err = 'Upload not found, see earlier logs for the details',
err = '"localhost:13301": Upload not found, see earlier logs for the details',
})

-- prefix should be cleaned up even if upload_transmit fails
Expand Down
3 changes: 2 additions & 1 deletion webui/cypress/integration/switchover.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ describe('Leader promotion tests', () => {
cy.get('span:contains(Edit is OK. Please wait for list refresh...)').click();

dropdownMenu('13302').contains('Promote a leader').click();
cy.get('span:contains(Leader promotion error) + span:contains(WaitRwError: timed out)').click();
cy.get('span:contains(Leader promotion error)' +
' + span:contains(WaitRwError: "localhost:13302": timed out)').click();

leaderFlag('13302').invoke('css', 'fill', orangeIcon);
leaderFlag('13303').should('not.exist');
Expand Down

0 comments on commit 29137d6

Please sign in to comment.