-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
daemon: FakeCommand usage requires reaper.Start()
The usage of testutil.FakeCommand requires the test environment to start and stop the reaper in the case where the reaper option is enabled. For example, in internals/daemon/daemon_test.go: : cmd := testutil.FakeCommand(c, "shutdown", "", true) : However, in daemon_test.go, the code is currently relying on the service manager, provided by the overlord, to start the reaper. This is not a safe solution as not all test implementations may actually run the real overlord code, and even if they do, we have a potential race condition. daemon.Init() -> overlord.New() -> servstate.NewManager() -> reaper.Start() The following changes are introduced: - Add reaper.Start() and reaper.Stop() to the daemon test setup and teardown. - Add a reaper based test for testutil.FakeCommand().
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters