Skip to content

server: fix grep_log not finding string logged immediately before #422

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

Merged
merged 3 commits into from
May 29, 2025

Conversation

locker
Copy link
Member

@locker locker commented May 29, 2025

Logs written by a test server go through a pipe and are processed by a luatest fiber before they make it to the log file so if grep_log() is called immediately after exec() that writes something to the log it may fail to find the logged string. Let's fix this issue by writing a unique marker string to the server log via exec() and retrying grep_log() until we find the marker.

Closes #421

nshy and others added 3 commits May 29, 2025 16:43
With Tarantool 3.2 and newer the test fails with:

```
...luatest/test/luaunit/assertions_error_test.lua:244: Unexpected error trace,
expected: {file = "/home/runner/work/luatest/luatest/luatest/assertions.lua", line = 102},
actual: {
    file = "...k/luatest/luatest/test/luaunit/assertions_error_test.lua",
    line = 236,
}
```

On older Tarantool versions the error trace isn't checked because
`tarantool._internal.trace_check_is_required` isn't defined there.
Tarantool 3.2 is the first version that defines this internal function.
Since `error.raise` used by the test resides in 'builtin/error.lua',
stack trace checking is enabled for this function.

The problem is `error.raise()` does not change the original error trace
while `t.assert_error_covers()` expects the trace to point to the place
where `error.raise()` was invoked. Let's use `box.error()` instead so
the new error has the expected trace.

Also change `box.error.ILLEGAL_PARAMS` to `box.error.UNSUPPORTED` for
the check to pass because in Tarantool 3.2 the former was changed to
`{type = 'IllegalParams'}`.
Ubuntu 20.04 is no longer supported by GitHub runners.

Note that Tarantool versions < 2.11 are too old and not available on
ubuntu-latest so they're removed from the test matrix. Instead we add
all Tarantool 3.x versions released so far.
Logs written by a test server go through a pipe and are processed by
a luatest fiber before they make it to the log file so if grep_log()
is called immediately after exec() that writes something to the log
it may fail to find the logged string. Let's fix this issue by writing
a unique marker string to the server log via exec() and retrying
grep_log() until we find the marker.

Closes tarantool#421
Copy link
Contributor

@nshy nshy left a comment

Choose a reason for hiding this comment

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

Checked the test fix commit.

@nshy nshy removed their assignment May 29, 2025
@locker locker merged commit e03b037 into tarantool:master May 29, 2025
13 of 14 checks passed
@locker locker deleted the grep-log-fix branch May 29, 2025 15:18
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.

server:grep_log() doesn't find string logged in preceding server:exec()
3 participants