-
Notifications
You must be signed in to change notification settings - Fork 11
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
Show log of tests #308
Comments
Description of current behavior (with more details)Note Luatest version: 0.5.7-44-g2d51155 Test source code: g.test_foo = function()
log.error('[ERROR] log')
log.warn('[WARNING] log')
log.info('[INFO] log')
log.verbose('[VERBOSE] log')
log.debug('[DEBUG] log')
g.server:exec(function()
log.error('[ERROR] server log')
log.warn('[WARNING] server log')
log.info('[INFO] server log')
log.verbose('[VERBOSE] server log')
log.debug('[DEBUG] server log')
end)
end Let's launch this test in different ways. luatest: run the test that will be
|
@ylobankov suggested adding a parameter for luatest Example: $ ./bin/luatest -c -v ./test/log_test.lua
Tarantool version is 2.11.1-0-g96877bd35
Started on Wed Sep 6 18:23:32 2023
log.test_log ...
[ERROR] log
[WARNING] log
[INFO] log
log.test_log ... (0.003s) Ok
=========================================================
Ran 1 tests in 0.004 seconds, 1 succeeded, 0 failed Is there too little information about the test? Just add the $ ./bin/luatest -c -v --debug ./test/log_test.lua
pc@workstation:~/workspace/vk/luatest$ ./bin/luatest -c -v --debug ./test/log_test.lua
Tarantool version is 2.11.1-0-g96877bd35
2023-09-06 18:23:17.556 [222330] main/103/luatest D> log.cfg({log=nil, level=7, nonblock=nil, format=plain})
2023-09-06 18:23:17.556 [222330] main/103/luatest I> Tarantool 2.11.1-0-g96877bd35 Linux-x86_64-RelWithDebInfo
2023-09-06 18:23:17.556 [222330] main/103/luatest I> log level 7
2023-09-06 18:23:17.556 [222330] main/103/luatest D> cbus_endpoint_create: locking &cbus.mutex
...
Started on Wed Sep 6 18:23:17 2023
log.test_log ...
2023-09-06 18:23:17.686 [222330] main/103/luatest/..test.log_test log_test.lua:14 E> [ERROR] log
2023-09-06 18:23:17.686 [222330] main/103/luatest/..test.log_test log_test.lua:15 W> [WARNING] log
2023-09-06 18:23:17.686 [222330] main/103/luatest/..test.log_test I> [INFO] log
2023-09-06 18:23:17.686 [222330] main/103/luatest/..test.log_test V> [VERBOSE] log
2023-09-06 18:23:17.686 [222330] main/103/luatest/..test.log_test D> [DEBUG] log
log.test_log ... (0.004s) Ok
=========================================================
Ran 1 tests in 0.004 seconds, 1 succeeded, 0 failed
2023-09-06 18:23:17.698 [222330] main D> cpipe_flush_cb: locking &endpoint->mutex
... @alyapunov what do you think about this param? IMHO: I like working with logs because one of the tasks of the luatest is to transparently show the state of testing (and internal logic). Now it's all hidden and not visible. I would like to see something like this: $ ./bin/luatest --log-level VERBOSE ...
or
$ ./bin/luatest --log-level 6 ... |
I don't need the log levels and I don't see how they would help me. What I'd like to have to debug test is a single log file that would contain messages from all test servers and the main test process. It'd be nice if To illustrate what I mean, suppose we have the following test case: g.test_foo = function(cg)
t.log('message 1')
cg.server1:exec(function()
t.log('message 2')
t.assert_equals(box.info.status, 'running')
end)
t.log('message 3')
cg.server2:exec(function()
t.log('message 4')
t.assert_equals(box.info.status, 'running')
end)
end Then I imagine the log would contain something like this upon running the test case:
Note this log file has nothing to do with Tarantool log. |
A couple of thoughts in addition.
This issue is about improving of convenience of writing new tests. We can make mistakes in test and want to find out them, and tarantool itself can do unexpected thing and we want to figure out when and what. |
Maybe write logs from all instances including the test process to a single file using the Tarantool syslog logger and always save this file? It'd be easier to analyze if one could see the linear history of events from all servers and the test. And if log from a single instance was required, one could easily filter it out by prefix. |
We see three related tasks:
@alyapunov, @locker I suggest solving the first problem and creating separate tasks for the rest. |
Now luatest will always clear the server vardir (`/tmp/t` by default) before running tests. You should be specify a new `--not-clean` parameter to disable this deletion. Also luatest does not delete the server workdir in the Server:drop(). Part of tarantool#308
Now luatest will always clear the server vardir (`/tmp/t` by default) before running tests. You should be specify a new `--not-clean` parameter to disable this deletion. Also luatest does not delete the server workdir in the Server:drop(). Part of tarantool#308
Now luatest will always clear the server vardir (`/tmp/t` by default) before running tests. You should be specify a new `--not-clean` parameter to disable this deletion. Also luatest does not delete the server workdir in the Server:drop(). Part of tarantool#308
Now luatest will always clear the server vardir (`/tmp/t` by default) before running tests. You should be specify a new `--no-clean` parameter to disable this deletion. Also luatest does not delete the server workdir in the Server:drop(). Part of tarantool#308
Now luatest will always clear the server vardir (`/tmp/t` by default) before running tests. You should be specify a new `--no-clean` parameter to disable this deletion. Also luatest does not delete the server workdir in the Server:drop(). Part of tarantool#308
Now, luatest does not delete the server's working directory in the drop() function. Instead of this, it deletes the whole var dir (default: /tmp/t) before running tests. So all server artifacts from all tests are saved after the run and can be analyzed. However, you can disable this deletion by specifying the new `--no-clean` option. Part of tarantool#308
Now, luatest does not delete the server's working directory in the drop() function. Instead of this, it deletes the whole var dir (default: /tmp/t) before running tests. So all server artifacts from all tests are saved after the run and can be analyzed. However, you can disable this deletion by specifying the new `--no-clean` option. Part of tarantool#308
Now, luatest does not delete the server's working directory in the drop() function. Instead of this, it deletes the whole var dir (default: /tmp/t) before running tests. So all server artifacts from all tests are saved after the run and can be analyzed. However, you can disable this deletion by specifying the new `--no-clean` option. Part of tarantool#308
Now, luatest does not delete the server's working directory in the drop() function. Instead of this, it deletes the whole var dir (default: /tmp/t) before running tests. So all server artifacts from all tests are saved after the run and can be analyzed. However, you can disable this deletion by specifying the new `--no-clean` option. Part of tarantool#308
Now, luatest does not delete the server's working directory in the drop() function. Instead of this, it deletes the whole var dir (default: /tmp/t) before running tests. So all server artifacts from all tests are saved after the run and can be analyzed. However, you can disable this deletion by specifying the new `--no-clean` option. Part of tarantool#308
Now, luatest does not delete the server's working directory in the drop() function. Instead of this, it deletes the whole var dir (default: /tmp/t) before running tests. So all server artifacts from all tests are saved after the run and can be analyzed. However, you can disable this deletion by specifying the new `--no-clean` option. Part of tarantool#308
Now, luatest does not delete the server's working directory in the drop() function. Instead of this, it deletes the whole var dir (default: /tmp/t) before running tests. So all server artifacts from all tests are saved after the run and can be analyzed. However, you can disable this deletion by specifying the new `--no-clean` option. Part of #308
The `--no-clean` option was added after the luatest update [1]. Test-run uses luatest but independently performs the preparation (creation and cleaning of directories). Therefore this option was added to avoid incompatibility between the two tools. [1] tarantool/luatest@18859f6 Part of tarantool/luatest#308
The `--no-clean` option was added after the luatest update [1]. Test-run uses luatest but independently performs the preparation (creation and cleaning of directories). Therefore this option was added to avoid incompatibility between the two tools. [1] tarantool/luatest@18859f6 Part of tarantool/luatest#308
The `--no-clean` option was added after the luatest update [1]. Test-run uses luatest but independently performs the preparation (creation and cleaning of directories). Therefore this option was added to avoid incompatibility between the two tools. [1] tarantool/luatest@18859f6 Part of tarantool/luatest#308
By default, test-run captures the stderr stream and redirects its to the log file: $ cat /tmp/t/001_foo-luatest/foo_test.log: [001] Some error log [001] My warning log ... Use the new option `--show-capture` (abbr. `-c`) to redirect stderr to stdout. Use it instead of the deprecated `--verbose` option. The `--verbose` option will be ignored and output: Argument ['--verbose'] is deprecated and is ignored. Close tarantool/luatest#308
By default, test-run captures the stderr stream and redirects its to the log file: $ cat /tmp/t/001_foo-luatest/foo_test.log: [001] Some error log [001] My warning log ... Use the new option `--show-capture` (abbr. `-c`) to redirect stderr to stdout. Use it instead of the deprecated `--verbose` option. The `--verbose` option will be ignored and output: Argument ['--verbose'] is deprecated and is ignored. Close tarantool/luatest#308
By default, test-run captures the stderr stream and redirects its to the log file: $ cat /tmp/t/001_foo-luatest/foo_test.log: [001] Some error log [001] My warning log ... Use the new option `--show-capture` (abbr. `-c`) to redirect stderr to stdout. Use it instead of the deprecated `--verbose` option. The `--verbose` option will be ignored and output: Argument ['--verbose'] is deprecated and is ignored. Close tarantool/luatest#308
We synchronize the options of two tools: test-run and luatest. When luatest runs separate tarantool instance it duplicates the streams thereby we can see logs(warning, error, etc) and prints. We have added a context manager to create the same behavior with luatest. Close tarantool/luatest#308
We synchronize the options of two tools: test-run and luatest. When luatest runs separate tarantool instance it duplicates the streams thereby we can see logs(warning, error, etc) and prints. We have added a context manager to create the same behavior with luatest. Close tarantool/luatest#308
We synchronize the options of two tools: test-run and luatest. When luatest runs separate tarantool instance it duplicates the streams thereby we can see logs(warning, error, etc) and prints. We have added a context manager to create the same behavior with luatest. Close tarantool/luatest#308
We synchronize the options of two tools: test-run and luatest. When luatest runs separate tarantool instance it duplicates the streams thereby we can see logs(warning, error, etc) and prints. We have added a context manager to create the same behavior with luatest. Close tarantool/luatest#308
Finally, it should be fixed by #345. |
Now log sometimes seems not to work at all, and even it works, it must be saved when tests are completed.
Sometimes logs are the only thing that helps to understand what's going on. So we should always write them and don't clean them after the test is finished. Perhaps we should clean the log right before the test is run.
The text was updated successfully, but these errors were encountered: