示例#1
0
func (s *InterfaceSuite) TestRequestRebootNow(c *gc.C) {
	ctx := runner.HookContext{}
	p := s.startProcess(c)
	ctx.SetProcess(p)
	go func() {
		_, err := p.Wait()
		c.Assert(err, jc.ErrorIsNil)
	}()
	err := ctx.RequestReboot(jujuc.RebootNow)
	c.Assert(err, jc.ErrorIsNil)
	priority := ctx.GetRebootPriority()
	c.Assert(priority, gc.Equals, jujuc.RebootNow)
}
示例#2
0
func (s *InterfaceSuite) TestRequestRebootAfterHook(c *gc.C) {
	if runtime.GOOS == "windows" {
		c.Skip("bug 1403084: Cannot send sigterm on windows")
	}
	ctx := runner.HookContext{}
	p := s.startProcess(c)
	ctx.SetProcess(p)
	err := ctx.RequestReboot(jujuc.RebootAfterHook)
	c.Assert(err, jc.ErrorIsNil)
	err = p.Signal(syscall.SIGTERM)
	c.Assert(err, jc.ErrorIsNil)
	_, err = p.Wait()
	c.Assert(err, jc.ErrorIsNil)
	priority := ctx.GetRebootPriority()
	c.Assert(priority, gc.Equals, jujuc.RebootAfterHook)
}