Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change conversion of box.error to string in error message assertions #355

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CuriousGeorgiy
Copy link
Member

This patch changes the conversion of box.error to string to retain the behavior after tarantool/tarantool#9105.

Needed for tarantool/tarantool#9105

CuriousGeorgiy added a commit to CuriousGeorgiy/test-run that referenced this pull request Feb 22, 2024
New version includes the following commits.

- Change conversion of `box.error` to string in error message
  assertions [1]

[1]: tarantool/luatest@xxx (WIP tarantool/luatest#355)
CuriousGeorgiy added a commit to CuriousGeorgiy/test-run that referenced this pull request Feb 22, 2024
New version includes the following commits.

- Change conversion of `box.error` to string in error message
  assertions [1]

[1]: tarantool/luatest@xxx (WIP tarantool/luatest#355)
CuriousGeorgiy added a commit to CuriousGeorgiy/test-run that referenced this pull request Feb 22, 2024
New version includes the following commits.

- Change conversion of `box.error` to string in error message
  assertions [1]

[1] tarantool/luatest@xxx (WIP tarantool/luatest#355)
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Currently, error message assertions convert `box.error` to string using
`tostring`. `box.error`'s `__tostring` metamethod is currently equivalent
to the `message` field of `box.error`. In scope of tarantool#9105, we are going to
increase the verbosity of `box.error` `__tostring` metamethod, and it will
no longer be convenient for testing the error message. Let's replace
`tostring(error)` usage with `error.message` to retain the old behaviour.

See also tarantool/luatest@xxx (WIP tarantool/luatest#355).

Needed for tarantool#9105

NO_CHANGELOG=<tests change>
NO_DOC=<tests change>
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
CuriousGeorgiy added a commit to CuriousGeorgiy/test-run that referenced this pull request Feb 22, 2024
New version includes the following commits.

- Change conversion of `box.error` to string in error message
  assertions [1]

[1] tarantool/luatest@xxx (WIP tarantool/luatest#355)
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Currently, error message assertions convert `box.error` to string using
`tostring`. `box.error`'s `__tostring` metamethod is currently equivalent
to the `message` field of `box.error`. In scope of tarantool#9105, we are going to
increase the verbosity of `box.error` `__tostring` metamethod, and it will
no longer be convenient for testing the error message. Let's replace
`tostring(error)` usage with `error.message` to retain the old behaviour.

See also tarantool/luatest@xxx (WIP tarantool/luatest#355).

Needed for tarantool#9105

NO_CHANGELOG=<tests change>
NO_DOC=<tests change>
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
Currently, error message assertions convert `box.error` to string using
`tostring`. The string conversion metamethod of `box.error` is currently
equivalent to the `message` field of `box.error`. In scope of
tarantool/tarantool#9105, we are going to increase the verbosity of
the string metamethod, and it will no longer be suitable for testing error
messages. Let's replace `tostring(error)` conversions with `error.message`
to retain the old behaviour.

Needed for tarantool/tarantool#9105
CuriousGeorgiy added a commit to CuriousGeorgiy/test-run that referenced this pull request Feb 22, 2024
New version includes the following commits.

- Change conversion of `box.error` to string in error message
  assertions [1]

[1] tarantool/luatest@xxx (WIP tarantool/luatest#355)
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
CuriousGeorgiy added a commit to CuriousGeorgiy/test-run that referenced this pull request Feb 22, 2024
New version includes the following commits.

- Change conversion of `box.error` to string in error message
  assertions [1]

[1] tarantool/luatest@xxx (WIP tarantool/luatest#355)
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
`box.error`'s string conversion metamethod is currently equivalent
to the `message` field of `box.error`. In scope of tarantool#9105, we are going to
increase the verbosity of the string conversion metamethod, and it will
no longer be suitable for testing the error message. Let's replace
`tostring(error)` usage with `error.message` to retain the old behaviour.

See also tarantool/luatest@xxx (WIP tarantool/luatest#355).

Needed for tarantool#9105

NO_CHANGELOG=<tests change>
NO_DOC=<tests change>
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
net.box's `eval` method always throws a `box.error` in case of an error.
When we decode the `eval` we result, in case of an error we currently rely
on the fact that the string conversion metamethod returns the error's
message.

However, in scope of tarantool/tarantool#9105, we are going to increase the
verbosity of the string conversion metamethod, and it will no longer return
the error's message. Let's explicitly extract the error's message to retain
the old behaviour.

Needed for tarantool/tarantool#9105
CuriousGeorgiy added a commit to CuriousGeorgiy/test-run that referenced this pull request Feb 22, 2024
New version includes the following commits.

- Change conversion of `box.error` to string in error message
  assertions [1]

[1] tarantool/luatest@xxx (WIP tarantool/luatest#355)
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 22, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
CuriousGeorgiy added a commit to CuriousGeorgiy/tarantool that referenced this pull request Feb 26, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.0-5-gxxx (WIP tarantool/luatest#355) [1]
- Disable verbose serialization of box.error in diff tests [2]

[1] tarantool/test-run@xxx (WIP tarantool/test-run#tarantool#424)
[2] tarantool/test-run@xxx (WIP tarantool#424)

NO_DOC=test
NO_TEST=test
NO_CHANGELOG=test
@@ -611,7 +611,9 @@ end

local function exec_tail(ok, ...)
if not ok then
local _ok, res = pcall(json.decode, tostring(...))
local err = ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is new code block compatible with Tarantool 1.10?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants