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

Isolate tests running as root locally #129

Open
nirs opened this issue Apr 12, 2022 · 1 comment
Open

Isolate tests running as root locally #129

nirs opened this issue Apr 12, 2022 · 1 comment
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

Some tests like storage tests (lvm, blocksd) require root. It is possible to run them
like this:

sudo ~/.venv/vdsm/bin/tox -e storage tests/storage/lvm_test.py

But after that, some files in .tox, tests and /var/tmp/vdsm are owned by root, so
the next tests run as regular user will break with permissions errors.

Developers can fix this using:

sudo chown -R $USER:$USER .tox tests/htmlcov* /var/tmp/vdsm

But this is ugly. We need an easy way to run tests as root that does not require any
cleanup after running the tests.

One way to fix this is to use separate directories for:

  • Pytest temporary directory (pytest has solution for this)
  • .tox directory
  • tests/htmlcov* directories

Another way is to run the tests in a container, but some lvm tests do not work in a container.

@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
Copy link
Member

I think this issue may be already covered in #276 .

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

No branches or pull requests

2 participants