Exemple #1
0
func (*RestartWorkersSuite) TestValidateSuccess(c *gc.C) {
	config := workers.RestartConfig{
		Factory: struct{ workers.Factory }{},
		Logger:  loggo.GetLogger("test"),
		Clock:   struct{ clock.Clock }{},
		Delay:   time.Nanosecond,
	}
	err := config.Validate()
	c.Check(err, jc.ErrorIsNil)
}
Exemple #2
0
func checkInvalidRestartConfig(c *gc.C, config workers.RestartConfig, match string) {
	check := func(err error) {
		c.Check(err, jc.Satisfies, errors.IsNotValid)
		c.Check(err, gc.ErrorMatches, match)
	}

	err := config.Validate()
	check(err)

	rw, err := workers.NewRestartWorkers(config)
	if !c.Check(rw, gc.IsNil) {
		workertest.DirtyKill(c, rw)
	}
	check(err)
}