Description
I'm working on getting pants to run our unit tests via pytest (I figure we can deal with integration tests later once all unit tests are running). I've got most of the st2common unit tests passing, but I've run into an assumption in our test suite that I would like to get rid of. The question is how.
Problematic assumption: That the system running our tests has the system_user
(typically stanley
).
For GHA, we had to add setup tasks that modify the conf files to use runner
instead of stanley
... But then we also create the stanley
user "for ssh".
For vagrant, adding a user is not a big ask. Similar for docker containers.
But for local development (eg with vim, or with PyCharm, or whatever people prefer), I want to be able to at least run the unit tests without creating that user.
What's worse, the tests fail without indicating that the reason they failed was because the stanley
user is not present.
I noticed in the log output that the core.echo action was triggering the command: sudo -E -H -u stanley -- bash -c 'echo "<% ctx().msg1 %>"'
which was weird because the sudo
parameter was false in the test's sample workflow. Apparently, the local-command-runner will use sudo -u <system_user>
if the current user is not the same as system_user.
How can we make the default system_user match the current user, at least for unit tests?
Maybe whatever solution we come up with will lead to removing those GHA user setup tasks for the unit tests (requiring the user for integration tests doesn't bother me).
Activity