Skip to content

Commit

Permalink
test(testutil): fix usage of reaper in exec_test.go (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhoyt authored Aug 18, 2023
1 parent 03e42a6 commit 58ec377
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions internals/testutil/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ type fakeCommandSuite struct{}

var _ = check.Suite(&fakeCommandSuite{})

func (s *fakeCommandSuite) SetUpSuite(c *check.C) {
err := reaper.Start()
c.Assert(err, check.IsNil)
}

func (s *fakeCommandSuite) TearDownSuite(c *check.C) {
err := reaper.Stop()
c.Assert(err, check.IsNil)
}

func (s *fakeCommandSuite) TestFakeCommand(c *check.C) {
fake := FakeCommand(c, "cmd", "true", false)
defer fake.Restore()
Expand All @@ -59,10 +49,20 @@ func (s *fakeCommandSuite) TestFakeCommand(c *check.C) {
}

func (s *fakeCommandSuite) TestFakeCommandWithReaper(c *check.C) {
err := reaper.Start()
c.Assert(err, check.IsNil)
defer func() {
err := reaper.Stop()
c.Assert(err, check.IsNil)
}()

fake := FakeCommand(c, "cmd", "true", true)
defer fake.Restore()
err := exec.Command("cmd", "").Run()

cmd := exec.Command("cmd", "")
out, err := reaper.CommandCombinedOutput(cmd)
c.Assert(err, check.IsNil)
c.Assert(string(out), check.Equals, "")
}

func (s *fakeCommandSuite) TestFakeCommandAlso(c *check.C) {
Expand Down

0 comments on commit 58ec377

Please sign in to comment.