Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

registry/rpc: re-enable error handling after NewSystemdUnitManage #1693

Merged
merged 2 commits into from
Oct 27, 2016

Conversation

dongsupark
Copy link
Contributor

@dongsupark dongsupark commented Oct 21, 2016

Run TestRegistryMuxUnitManagement() only when user's euid is 0 and systemd is available at run-time. Such a distinction is necessary for avoiding test failures, especially when unit tests run on travis CI, where systemd is not available. With those checks, we can re-enable error handling after calling systemd.NewSystemdUnitManager().

Besides fix also a hidden bug in TestWrongHostKeyFile() to skip the test on Linux if euid is 0. On Linux syscall.Setuid() is not supported in go. So running unit tests with root privileges fails when calling Setuid.

Run TestRegistryMuxUnitManagement() only when user's euid is 0 and
systemd is avilable at run-time. Such a distinction is necessary for
avoiding test failures, especially when unit tests run on travis CI,
where systemd is not available.

With those checks, we can re-enable error handling after calling
systemd.NewSystemdUnitManager().
@dongsupark dongsupark force-pushed the dongsu/unit-test-rootuser-systemd branch from 3f2cc17 to 2d3000f Compare October 22, 2016 07:18
@dongsupark dongsupark changed the title test: run unit tests in registry/rpc only for necessary cases registry/rpc: re-enable error handling after NewSystemdUnitManage Oct 22, 2016
@dongsupark dongsupark force-pushed the dongsu/unit-test-rootuser-systemd branch 2 times, most recently from 9156dd3 to c86e6d0 Compare October 22, 2016 07:39
On Linux syscall.Setuid() is not supported in go. So running unit tests
with root privileges fails when calling Setuid.
Let's skip the test on Linux, if euid is 0.
@dongsupark
Copy link
Contributor Author

Last week I changed this PR, to check euid and systemd not in a shell script, but in registrymux_test.go. That way we could get the checks applied to only a necessary test case, instead of an entire directory registry/rpc.

I'm going to merge this PR in this week, as it fixes real bugs, and it changes only unit tests.

@dongsupark dongsupark merged commit a11d017 into coreos:master Oct 27, 2016
@dongsupark dongsupark deleted the dongsu/unit-test-rootuser-systemd branch October 27, 2016 08:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant