Flamenco Unit Test - meta_test.go - TestCheckSharedStoragePath fails if run as root user (linux) #104233
Labels
No Label
Good First Issue
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status
Confirmed
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Job Type
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: studio/flamenco#104233
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating System(s): Ubuntu / linux
Flamenco Version
Is Broken: main branch
Worked OK: This works for non-root users.
Short description of error
https://projects.blender.org/studio/flamenco/src/branch/main/internal/manager/api_impl/meta_test.go#L191
If the mock tests are run by root user then this specific test of inaccessible path fails because root can write files to anywhere on the filesystem. It is not clear that Flamenco Manager test TestCheckSharedStoragePath is checking inaccessible file locations when it fails and that it should be run by an unprivileged user.
Exact steps for others to reproduce the error
Method 1 - On a local workstation as root.
sudo su - root
make test
Method 2 - In a docker container with a default root user.
Example error...
The error means it was in fact successful in creating a file in a permission-restricted sub folder (eg:
/tmp/test-temp-dir2053501336/deep/nesting/
) on a non-windows platform (ie: linux)...A side effect of this test failing appears to mock test testing.go CreateTestConfig() leave ~5 "shaman-test-*" directories lying around despite there being cleanup function to remove them.
Clean in this function doesn't appear to happen...
https://projects.blender.org/studio/flamenco/src/branch/main/pkg/shaman/config/testing.go#L34
Example from one
make test
run...Possible solution #104234
The unit tests should not be run as root, so the fact that they're broken in that case seems acceptable to me. Any program should be run as non-privileged user, unless explicitly mentioned that it requires otherwise. So I don't feel that this is an issue. If anything, it forces people to set up their Docker environment to use a regular user account, instead of defaulting to root.
As for #104234, I'll comment on that PR directly.
Makes sense. Thanks for the feedback!