Exemplo n.º 1
0
func (s *serviceSuite) TestRestartNotRoot(c *gc.C) {
	s.Stub.Euid = 1000

	err := syslog.Restart()

	c.Check(err, gc.ErrorMatches, `.*must be root.*`)
	s.Stub.CheckCallNames(c, "Geteuid")
}
Exemplo n.º 2
0
func (s *serviceSuite) TestRestartRoot(c *gc.C) {
	s.Stub.Euid = 0

	err := syslog.Restart()
	c.Assert(err, jc.ErrorIsNil)

	s.Stub.CheckCallNames(c, "Geteuid", "Restart")
}
Exemplo n.º 3
0
func (s *serviceSuite) TestRestartError(c *gc.C) {
	s.Stub.Euid = 0
	failure := errors.New("<failed>")
	s.Stub.SetErrors(nil, failure) // Geteuid, Restart

	err := syslog.Restart()

	c.Check(errors.Cause(err), gc.Equals, failure)
	s.Stub.CheckCallNames(c, "Geteuid", "Restart")
}