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

Second value after nil is not returned from server.exec #350

Closed
Serpentian opened this issue Jan 16, 2024 · 1 comment · Fixed by #351
Closed

Second value after nil is not returned from server.exec #350

Serpentian opened this issue Jan 16, 2024 · 1 comment · Fixed by #351
Labels
bug Something isn't working

Comments

@Serpentian
Copy link
Contributor

Second value after nil is not returned from server.exec. Caused by e6a2093.

local server = require('luatest.server')
local t = require('luatest')
local g = t.group()

g.before_all = function(lg)
    lg.master = server:new({alias = 'master'})
    lg.master:start()
end

g.after_all = function(lg)
    lg.master:drop()
end

g.test_check = function(lg)
    local a, b = lg.master:exec(function()
        return nil, {message = "msg"}
    end)

    t.assert_equals(a, nil)
    t.assert_equals(b.message, "msg")
end
[002] replication-luatest/new_test.lua                                [ fail ]
[002] Test failed! Output from reject file /tmp/t/rejects/replication-luatest/new.reject:
[002] Tarantool version is 3.1.0-entrypoint-26-g57b902887
[002] TAP version 13
[002] 1..1
[002] # Started on Tue Jan 16 16:28:19 2024
[002] # Starting group: replication-luatest.new
[002] not ok 1	replication-luatest.new.test_check
[002] #   ...ming/tnt/tarantool/test/replication-luatest/new_test.lua:20: attempt to index local 'b' (a nil value)
[002] #   stack traceback:
[002] #   	...
[002] #   	[C]: in function 'xpcall'
[002] #   artifacts:
[002] #   	master -> /tmp/t/002_replication-luatest/artifacts/master-tQXcu8z2MNYt
[002] # Ran 1 tests in 0.314 seconds, 0 succeeded, 1 errored
[002] 

@Serpentian
Copy link
Contributor Author

Blocks tarantool/vshard#459

@Serpentian Serpentian added the bug Something isn't working label Jan 16, 2024
DifferentialOrange added a commit that referenced this issue Jan 19, 2024
After [1], returning values after nil (for example, classic
`return nil, err` scenario) is broken. This patch restores the behavior.

1. e6a2093

Closes #350
DifferentialOrange added a commit that referenced this issue Jan 19, 2024
After previous commit, `:exec` support sparse output, but not sparse
args. It seems like a good idea to support it too, since it's too easy
now.

Follows #350
DifferentialOrange added a commit that referenced this issue Jan 19, 2024
After [1], returning values after nil (for example, classic
`return nil, err` scenario) is broken. This patch restores the behavior.

Since `net.box` already handles `nil` args input with `box.NULL`,
everything is fine for exec arguments.

1. e6a2093

Closes #350
DifferentialOrange added a commit that referenced this issue Jan 19, 2024
After [1], returning values after nil (for example, classic
`return nil, err` scenario) is broken. This patch restores the behavior.

Since server doesn't always has access to `require('luatest.utils')`,
utility is provided through its dump.

Since `net.box` already handles `nil` args input with `box.NULL`,
everything is fine for exec arguments.

1. e6a2093

Closes #350
DifferentialOrange added a commit that referenced this issue Jan 19, 2024
After [1], returning values after nil (for example, classic
`return nil, err` scenario) is broken. This patch restores the behavior.

Since server doesn't always has access to `require('luatest.utils')`,
utility is provided through its dump.

Since `net.box` already handles `nil` args input with `box.NULL`,
everything is fine for exec arguments.

1. e6a2093

Closes #350
ochaplashkin pushed a commit that referenced this issue Jan 19, 2024
After [1], returning values after nil (for example, classic
`return nil, err` scenario) is broken. This patch restores the behavior.

Since server doesn't always has access to `require('luatest.utils')`,
utility is provided through its dump.

Since `net.box` already handles `nil` args input with `box.NULL`,
everything is fine for exec arguments.

1. e6a2093

Closes #350
DifferentialOrange added a commit that referenced this issue Jan 19, 2024
Simplify code from PR #351 based on @Totktonada advice.

Follows #350
ochaplashkin pushed a commit that referenced this issue Jan 19, 2024
Simplify code from PR #351 based on @Totktonada advice.

Follows #350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant