Skip to content
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

Run the tests as unprivileged user #128

Closed
nirs opened this issue Apr 12, 2022 · 0 comments · Fixed by #276
Closed

Run the tests as unprivileged user #128

nirs opened this issue Apr 12, 2022 · 0 comments · Fixed by #276
Assignees
Labels
bug Issue is a bug or fix for a bug tests Issues related to automated tests

Comments

@nirs
Copy link
Member

nirs commented Apr 12, 2022

Most of vdsm code run as vdsm:kvm, but vdsm tests run as root by default in the CI.
This causes several problems:

  • Tests behave differently when run locally on developer machine and in the CI
  • Some tests cannot succeed when run as root, and are skipped in the CI. The tests and the code are likey to break because they are tested only locally.
  • Error in code that would fail in runtime running as vdsm:kvm are not detected in the tests, running as root:root.
  • We need special configuration to run the containers with privileges - this should be done only for tests that must run as root.

Fix:

  • Separate the tests that need to run as root from the tests that need to run as vdsm:kvm
  • Run the tests as vdsm:kvm or another unprivileged user
  • Run tests that needs root in a privileged container

In general only code that run via supervdsm need to be tested as root. Unfortunately the code running as root is mixed with other code in vdsm.

@nirs nirs added bug Issue is a bug or fix for a bug tests Issues related to automated tests labels Apr 12, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jun 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 5, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 6, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 6, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 6, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 7, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 8, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 8, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 8, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
@aesteve-rh aesteve-rh self-assigned this Jul 8, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 14, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: oVirt#128
Signed-off-by: Albert Esteve <[email protected]>
@nirs nirs closed this as completed in #276 Jul 15, 2022
nirs pushed a commit that referenced this issue Jul 15, 2022
Most of vdsm code run as vdsm:kvm, but vdsm tests run
as root by default in the CI, causing several problems, e.g.:
- Different behaviour, when run locally and the CI
- Some tests are skipped as root

We can separate the tests in two different jobs:
- storage-tests: run test marked as "not root".
  It still requires the container to be privileged
  for setting up the storage.
- storage-tests-root: run tests marked as "root".

Fixes: #128
Signed-off-by: Albert Esteve <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is a bug or fix for a bug tests Issues related to automated tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants