running tests as root fails
[sudo] password for miek:
--- FAIL: TestEndToEnd (0.00s)
main_test.go:74: run(exec) = -c flag is mandatory, want not root
FAIL
exit status 1
normally this would not be an issue, but I probably want to run the go test in the github actions workflow as root, so bind mounts and the like can easily be created, or should we mock that in some kind of way? WDYT @matttproud ?
That is a good question:
How many things require root: systemd interactions and bind mounting and privilege setting with subcommands?
Do you think it would be easy to ensure that the context in which they run with the actions workflow can be made to execute as root? I was thinking about creating interfaces and test doubles for the things I mentioned (as a part of ExecContext) that could be used for local automated testing.
Message ID: @.***>
How many things require root: systemd interactions and bind mounting and privilege setting with subcommands?
yes mostly that: mount, mkdir/chown and systemd.
Note for systemd we just call the command you don't actually get the feedback if the restart was successful (that's available with 'status' or via journald). So in that sense we could just test that we run the correct command.
Bind mounts however....Maybe in we can do it in a namespace? But system wide needs root, maybe also check that we run in the correct command(s)?