scylladb / scylla-cluster-tests

Tests for Scylla Clusters
GNU Affero General Public License v3.0
58 stars 95 forks source link

In the middle of sct test on docker backend sct asks for sudo password #9028

Closed asias closed 2 days ago

asias commented 1 month ago

It is under docker images. The sudo password should not be needed.

$ export SCT_SCYLLA_VERSION=6.1.2
$ export SCT_ENABLE_ARGUS=False

$ hydra run-test performance_regression_test.PerformanceRegressionTest.test_latency_write_with_nemesis --backend docker --config test-cases/performance/perf-regression-latency-650gb-with-nemesis.yaml  --config configurations/tablets_disabled.yaml --config configurations/disable_kms.yaml
< t:2024-10-23 06:33:25,998 f:cluster.py      l:2203 c:sdcm.cluster         p:INFO  > Node perf-latency-nemesis-asias-db-node-fbe408ba-0 [172.18.0.2 | 172.18.0.2]: Found ScyllaDB version: 6.1.2
< t:2024-10-23 06:34:27,865 f:cluster.py      l:1998 c:sdcm.cluster_docker  p:INFO  > Node perf-latency-nemesis-asias-monitor-node-fbe408ba-0 [127.0.0.1 | 127.0.0.1]: Installing Scylla...

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.
asias commented 6 days ago

I think it is related to monitor. Monitor is not supported in the docker backend. It tries to do something on host that is the reason it asks for password. After I disable monitor, no password is asked for.

dimakr commented 6 days ago

Seems like the test here was trying to perform the action - scylla-manager server installation - that is not yet supported on the docker backend. Raised an issue / feature request for that - https://github.com/scylladb/scylla-cluster-tests/issues/9323. For now we disable scylla-manager usage when running tests on docker backend, by adding use_mgmt: false to a test config, or setting SCT_USE_MGMT=false env var.

But this still don't justify the original problem of asking password when executing command with sudo. For instance in my system, even when running the test without manager disabled, I'm failing on a code

        if self.is_docker():
            self.remoter.sudo(
                "yum remove -y scylla scylla-jmx scylla-tools scylla-tools-core scylla-server scylla-conf")

with the error:

< t:2024-11-21 11:39:24,751 f:tester.py       l:196  c:sdcm.tester          p:ERROR > Command: 'sudo yum remove -y scylla scylla-jmx scylla-tools scylla-tools-core scylla-server scylla-conf'                      │
...
< t:2024-11-21 11:39:24,751 f:tester.py       l:196  c:sdcm.tester          p:ERROR > Stderr:                                                                                                                       │
< t:2024-11-21 11:39:24,751 f:tester.py       l:196  c:sdcm.tester          p:ERROR >                                                                                                                               │
< t:2024-11-21 11:39:24,751 f:tester.py       l:196  c:sdcm.tester          p:ERROR > sudo: yum: command not found 

I.e. it was ok with the sudo..

dimakr commented 6 days ago

But this still don't justify the original problem of asking password when executing command with sudo. For instance in my system, even when running the test without manager disabled, I'm failing on a code

        if self.is_docker():
            self.remoter.sudo(
                "yum remove -y scylla scylla-jmx scylla-tools scylla-tools-core scylla-server scylla-conf")

So the reason of asking sudo password in the place above is simply due to the fact that self.remoter is the host machine here (as for docker backend the monitoring stack is installed into host machine, not on a dedicated docker instance).

self
Out[2]: <sdcm.cluster_docker.DockerMonitoringNode at 0x7f42b9759600>
self.remoter
Out[3]: <sdcm.remote.local_cmd_runner.LocalCmdRunner at 0x7f42c9cd6d40>
...
self.remoter.run('hostname').stdout
Out[6]: 'dmitriy-d3581\n'

So depending on whether passwordless sudo is configured on a dev machine or not, the password can be asked or not. We probably need to add a check, so that we fail fast if docker backend is used and use_mgmt/SCT_USE_MGMT config parameter is not set to false.