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

functional: fix error from message change from systemctl status #1700

Merged
merged 1 commit into from
Nov 2, 2016

Conversation

dongsupark
Copy link
Contributor

Since systemd v231, TestNodeShutdown fails with the following message.

--- FAIL: TestNodeShutdown (fleet.conf=[enable_grpc=false]) (8.98s)
        node_test.go:83: Unit hello.service not reported as inactive:

It's because of behavioral change of "systemctl status". Until systemd v230, "systemctl status hello.service" has printed

Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

to stdout, when hello.service is not active. So the functional test TestNodeShutdown has expected a string "Active: inactive" in the message from stdout.

Since systemd v231, however, the output string has become

Unit hello.service could not be found

And it's printed to stderr, instead of stdout.

As MemberCommand() doesn't return stderr at all, we need to make it return stderr too. Changing prototype of MemberCommand() however requires a lot of changes all over functional tests. So let's add another helper MemberCommandStderr(), a distinct helper that returns both stdout and stderr. Then we can change only TestNodeShutdown()
without touching other tests.

In the long run, we need to change MemberCommand() directly, removing MemberCommandStderr().

Fixes #1699

@dongsupark
Copy link
Contributor Author

Ok, functional tests work fine now.
Travis CI fails suddenly with an error "unable to access gnutls_handshake() failed", when cloning a git repo. Not sure why. Though that looks unrelated.
I'm going to merge this PR as soon as possible. as it's rather an urgent fix.

Since systemd v231, TestNodeShutdown fails with the following message.

====
  --- FAIL: TestNodeShutdown (fleet.conf=[enable_grpc=false]) (8.98s)
          node_test.go:83: Unit hello.service not reported as inactive:
====

It's because of behavioral change of "systemctl status". Until systemd
v230, "systemctl status hello.service" has printed "Loaded: not-found
(Reason: No such file or directory)\nActive: inactive (dead)" to stdout,
when hello.service is not active. So the functional test
TestNodeShutdown has expected a string "Active: inactive" in the message
from stdout.

Since systemd v231, however, the output string has become "Unit NAME
could not be found", where NAME is the unit name. And it's printed to
stderr, instead of stdout.

As MemberCommand() doesn't return stderr at all, we need to make it
return stderr too. Changing prototype of MemberCommand() however
requires a lot of changes all over functional tests. So let's add
another helper MemberCommandStderr(), a distinct helper that returns
both stdout and stderr. Then we can change only TestNodeShutdown()
without touching other tests. In the long run, we need to change
MemberCommand() directly, removing MemberCommandStderr().

Fixes coreos#1699
@dongsupark
Copy link
Contributor Author

Yep, the gnutls handshake error was just intermittent. Now it's working fine.
I'll merge.

@dongsupark dongsupark merged commit 550ec41 into coreos:master Nov 2, 2016
@dongsupark dongsupark deleted the dongsu/systemd-errmsg-fxtests branch November 2, 2016 11:49
dongsupark pushed a commit that referenced this pull request Nov 2, 2016
functional: fix error from message change from systemctl status
dongsupark pushed a commit to endocode/fleet that referenced this pull request Nov 9, 2016
Remove Cluster.MemberCommand(), rename MemberCommandStderr() to
MemberCommand(), and update every call site accordingly.
That way we can clean up leftovers from coreos#1700.
dongsupark pushed a commit to endocode/fleet that referenced this pull request Nov 9, 2016
Remove Cluster.MemberCommand(), rename MemberCommandStderr() to
MemberCommand(), and update every call site accordingly.
That way we can clean up leftovers from coreos#1700.
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