Exemplo n.º 1
0
func (*DumbWorkersSuite) TestValidateSuccess(c *gc.C) {
	config := workers.DumbConfig{
		Factory: struct{ workers.Factory }{},
		Logger:  loggo.GetLogger("test"),
	}
	err := config.Validate()
	c.Check(err, jc.ErrorIsNil)
}
Exemplo n.º 2
0
func (*DumbWorkersSuite) TestValidateMissingFactory(c *gc.C) {
	config := workers.DumbConfig{
		Logger: loggo.GetLogger("test"),
	}
	check := func(err error) {
		c.Check(err, gc.ErrorMatches, "nil Factory not valid")
		c.Check(err, jc.Satisfies, errors.IsNotValid)
	}

	check(config.Validate())
	w, err := workers.NewDumbWorkers(config)
	if !c.Check(w, gc.IsNil) {
		workertest.CleanKill(c, w)
	}
	check(err)
}
Exemplo n.º 3
0
func (*DumbWorkersSuite) TestValidateUninitializedLogger(c *gc.C) {
	config := workers.DumbConfig{
		Factory: struct{ workers.Factory }{},
	}
	check := func(err error) {
		c.Check(err, gc.ErrorMatches, "uninitialized Logger not valid")
		c.Check(err, jc.Satisfies, errors.IsNotValid)
	}

	check(config.Validate())
	w, err := workers.NewDumbWorkers(config)
	if !c.Check(w, gc.IsNil) {
		workertest.CleanKill(c, w)
	}
	check(err)
}