Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daemon: FakeCommand usage requires reaper.Start() #247

Merged
merged 1 commit into from
Aug 1, 2023

Commits on Aug 1, 2023

  1. 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().
    flotter committed Aug 1, 2023
    Configuration menu
    Copy the full SHA
    374389a View commit details
    Browse the repository at this point in the history