You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
It doesn't set system_user.user to the current user by default, so people will still get weird errors until they figure out they need this and then they set the ST2TESTS_SYSTEM_USER env var with something like export ST2TESTS_SYSTEM_USER=${USER}. But, it's an improvement.
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
(typicallystanley
).For GHA, we had to add setup tasks that modify the conf files to use
runner
instead ofstanley
... But then we also create thestanley
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 thesudo
parameter was false in the test's sample workflow. Apparently, the local-command-runner will usesudo -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).
The text was updated successfully, but these errors were encountered: