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

Commit

Permalink
Fix gonit persist bug in tests.
Browse files Browse the repository at this point in the history
Change-Id: I29ee13aef48ce321c794cbcc48d47fa2d60eb85a
  • Loading branch information
lisbakke committed Nov 7, 2012
1 parent 8d200b9 commit a525a7a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions control_test.go
Expand Up @@ -14,7 +14,10 @@ type ControlSuite struct{}

var _ = Suite(&ControlSuite{})

var groupName = "controlTest"
var (
groupName = "controlTest"
gonitPersistFile = ".gonit.persist.yml"
)

type FakeEventMonitor struct {
numStartMonitoringCalled int
Expand All @@ -28,11 +31,17 @@ func (fem *FakeEventMonitor) Start(configManager *ConfigManager,
return nil
}

func (s *ControlSuite) TearDownTest(c *C) {
os.Remove(gonitPersistFile)
}

func (fem *FakeEventMonitor) Stop() {}

func (s *ControlSuite) TestActions(c *C) {
fem := &FakeEventMonitor{}
configManager := &ConfigManager{Settings: &Settings{}}
configManager := &ConfigManager{
Settings: &Settings{PersistFile: gonitPersistFile},
}
ctl := &Control{ConfigManager: configManager, EventMonitor: fem}

name := "simple"
Expand Down Expand Up @@ -72,7 +81,9 @@ func (s *ControlSuite) TestActions(c *C) {
}

func (s *ControlSuite) TestDepends(c *C) {
configManager := &ConfigManager{Settings: &Settings{}}
configManager := &ConfigManager{
Settings: &Settings{PersistFile: gonitPersistFile},
}
ctl := &Control{ConfigManager: configManager, EventMonitor: &FakeEventMonitor{}}

name := "depsimple"
Expand Down Expand Up @@ -188,7 +199,9 @@ func (s *ControlSuite) TestDepends(c *C) {
}

func (s *ControlSuite) TestLoadPersistState(c *C) {
configManager := &ConfigManager{Settings: &Settings{}}
configManager := &ConfigManager{
Settings: &Settings{PersistFile: gonitPersistFile},
}
control := &Control{ConfigManager: configManager}
testPersistFile := os.Getenv("PWD") + "/test/config/expected_persist_file.yml"
process := &Process{Name: "MyProcess"}
Expand Down

0 comments on commit a525a7a

Please sign in to comment.