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 without root #65

Open
dianarg opened this issue Jul 6, 2022 · 7 comments
Open

Run without root #65

dianarg opened this issue Jul 6, 2022 · 7 comments

Comments

@dianarg
Copy link

dianarg commented Jul 6, 2022

I would like to run these tests, but don't have root privileges. What would need to change to run these tests as a non-root user?

@asomers
Copy link
Collaborator

asomers commented Jul 6, 2022

It's basically impossible as they're written now. HOWEVER, @musikid is working on a pjdfstest rewrite which will include that feature: https://github.com/musikid/pjdfstest . Note though that the test coverage will be severely reduced when running as a non-root user.

@dianarg
Copy link
Author

dianarg commented Jul 19, 2022

As a workaround, I created a docker image containing pjdfstest and the build dependencies here: https://hub.docker.com/r/dianarg/pjdfstest. Use at your own risk. You can mount host directories to be tested using docker run --volume to make them visible within the container. Let me know if you want me to open a PR with the Dockerfile.

@dianarg
Copy link
Author

dianarg commented Jul 19, 2022

OK, after testing the above image on the rootless system, I am still seeing test failures. I'm not sure if this is related to using Rootless Docker, but I'll keep investigating.

@asomers
Copy link
Collaborator

asomers commented Jul 19, 2022

What exactly are you trying to accomplish? If you want 100% test coverage, then that absolutely requires root. Using Linux's FS namespaces you might be able to do some privileged operations as a non-root user, but probably not all.

@dianarg
Copy link
Author

dianarg commented Jul 19, 2022

I want to reproduce the testing done by the JuiceFS devs described in https://github.com/juicedata/juicefs#posix-compatibility. I was hoping running as "root" inside a container would get around checks for uid==0

Which tests absolutely require root, and which ones are using root as an artifact of how the tests are written? For example, I believe it should be possible to test operations like create/unlink/read/write as long as the test user has permissions on the directory used for the test.

@asomers
Copy link
Collaborator

asomers commented Jul 19, 2022

As-written, pjdfstest doesn't distinguish between tests that need root and tests that don't. But with @musikid's rewrite, it will. In that branch, a non-root user can do a smoke test that covers unprivileged operations like chmod and truncate. But a large part of the test suite will still require root privileges, and there isn't any getting around that.

@dianarg
Copy link
Author

dianarg commented Jul 21, 2022

Thanks @asomers , I will try playing around with @musikid's fork for now

asomers added a commit to asomers/pjdfstest that referenced this issue Jul 30, 2022
 It will build faster, we'll have fewer problems with private items, and the
compiler will better be able to find dead code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants