Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
corecfg: mock "systemctl" in all corecfg tests #3854
Conversation
mvo5
added this to the 2.28 milestone
Sep 5, 2017
codecov-io
commented
Sep 5, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #3854 +/- ##
==========================================
+ Coverage 75.71% 75.78% +0.06%
==========================================
Files 413 414 +1
Lines 35555 35742 +187
==========================================
+ Hits 26921 27086 +165
- Misses 6730 6745 +15
- Partials 1904 1911 +7
Continue to review full report at Codecov.
|
zyga
approved these changes
Sep 6, 2017
Hmm, I was under the impression that this would never ever touch the real systemctl. I recall seeing a bug (race?) where this test would sometimes fail to figure out something and then proceeded into the "real code" and call systemctl.
While I don't mind the explicit mocking I feel we are missing something here.
|
We do touch the real systemd because corecfg runs systemctl --version to detect if the core-support plug is connected. This is where this issue from from. Sorry for not explaining that in code better. |
| systemctlArgs [][]string | ||
| } | ||
| var _ = Suite(&servicesSuite{}) | ||
| func (s *servicesSuite) SetUpSuite(c *C) { | ||
| + s.coreCfgSuite.SetUpSuite(c) | ||
| + | ||
| systemd.SystemctlCmd = func(args ...string) ([]byte, error) { |
pedronis
Sep 6, 2017
Contributor
this looks strange, are we calling here systemctl both directly and through the systemd pkg? or we don't need coreCfgSuite here?
mvo5 commentedSep 5, 2017
This is needed to ensure the tests can run on a system that does
not have systemctl (like ubuntu 14.04).