tarantool / tarantool/tarantool

Wrap tap subtests with pcall

Open
#2,722 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

For example, when we write test:test with subtests, for example:

test:test("Chunked index with filter", function(test)
    local res = mock.run( test, 3, 'correct', 'data')
    test:is(res.ctl, 'customer', "Controller found")
    test:is(#res.index, 1, "Key detected")
    test:is(res.filter, "pers_data.name_first", "Filter detected")
end)

If data res is nil, the we'll get exception

[001] +2017-08-30 15:25:13.512 [22183] main/101/single.test.lua F> single.test.lua:100: attempt to index global 'res' (a nil value)

And tests'll be stopped. Better to wrap it with pcall/xpcall, catch exception and provide it (with stacktrace) in tap metadata.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin at the test:test subtest entry point and inspect how TAP metadata is emitted. Reproduce the nil res failure from the example, then trace pcall/xpcall handling and verify that the exception and stack trace are reported as TAP metadata without stopping later subtests.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.