Skip to content

tests: capture dmesg in integration tests#44535

Merged
alexey-milovidov merged 1 commit intoClickHouse:masterfrom
azat:tests/integration-dmesg
Dec 26, 2022
Merged

tests: capture dmesg in integration tests#44535
alexey-milovidov merged 1 commit intoClickHouse:masterfrom
azat:tests/integration-dmesg

Conversation

@azat
Copy link
Copy Markdown
Member

@azat azat commented Dec 23, 2022

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

This is to get more details for issues like:

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-not-for-changelog This PR should not be mentioned in the changelog label Dec 23, 2022
@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 23, 2022

Looks like it works:

[Fri Dec 23 17:07:39 2022] docker0: port 1(vethcf1ecbf) entered blocking state
[Fri Dec 23 17:07:39 2022] docker0: port 1(vethcf1ecbf) entered disabled state

@alexey-milovidov alexey-milovidov self-assigned this Dec 26, 2022
@alexey-milovidov alexey-milovidov merged commit a92a9b4 into ClickHouse:master Dec 26, 2022
@azat azat deleted the tests/integration-dmesg branch December 26, 2022 20:59
@nikitamikhaylov
Copy link
Copy Markdown
Member

nikitamikhaylov commented Dec 27, 2022

@azat @alexey-milovidov It doesn't work at all. Revert?

ubuntu@ip-10-1-13-116:~/ClickHouse/ClickHouse/tests/integration$ ./runner "-ss test_keeper_multinode_simple/test.py::test_follower_restart"
2022-12-27 15:29:42,927 [ 3833977 ] INFO : ClickHouse root is not set. Will use /home/ubuntu/ClickHouse/ClickHouse (runner:41, check_args_and_update_paths)
2022-12-27 15:29:42,927 [ 3833977 ] INFO : Cases dir is not set. Will use /home/ubuntu/ClickHouse/ClickHouse/tests/integration (runner:89, check_args_and_update_paths)
2022-12-27 15:29:42,927 [ 3833977 ] INFO : src dir is not set. Will use /home/ubuntu/ClickHouse/ClickHouse/src (runner:96, check_args_and_update_paths)
2022-12-27 15:29:42,927 [ 3833977 ] INFO : base_configs_dir: /home/ubuntu/ClickHouse/ClickHouse/programs/server/, binary: /home/ubuntu/ClickHouse/build/programs/clickhouse, cases_dir: /home/ubuntu/ClickHouse/ClickHouse/tests/integration  (runner:98, check_args_and_update_paths)
clickhouse_integration_tests_volume
dmesg: klogctl failed: Operation not permitted
Traceback (most recent call last):
  File "./runner", line 417, in <module>
    subprocess.check_call("dmesg --clear", shell=True)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'dmesg --clear' returned non-zero exit status 1.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 27, 2022

@nikitamikhaylov It looks like you don't have privileges for this command inside your container, although it works on CI.

I guess the fix for you will be to wrap this commands with sudo.

@alesapin
Copy link
Copy Markdown
Member

alesapin commented Dec 27, 2022

> I guess the fix for you will be to wrap this commands with sudo.
must work without sudo. @nikitamikhaylov, please consider reverting.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 27, 2022

must work without sudo. @nikitamikhaylov, please consider reverting

@alesapin it cannot work without sudo, you cannot clear dmesg buffer (SYSLOG_ACTION_CLEAR) without CAP_SYSLOG, this is simply prohibited.
You are against collecting dmesg for integration tests?

If so, there are other places where the same command is used:

So consider removing it too then.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 27, 2022

you cannot clear dmesg buffer (SYSLOG_ACTION_CLEAR) without CAP_SYSLOG, this is simply prohibited.

https://github.com/torvalds/linux/blob/1b929c02afd37871d5afb9d498426f83432e71c2/kernel/printk/printk.c#L611

@alexey-milovidov
Copy link
Copy Markdown
Member

@azat Let's make it degrade gracefully if the capability is unavailable - it can print an information message but not fail.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 28, 2022

@alexey-milovidov OK, actually simply moving it into another script (that is executed only by CI) will work too - #44667

@alesapin
Copy link
Copy Markdown
Member

@azat I'm not against collecting them in CI. But scripts which contributors use locally should never require sudo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants