func (s *InterfaceSuite) TestRequestRebootNow(c *gc.C) { ctx := context.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) }
func (s *InterfaceSuite) TestRequestRebootAfterHook(c *gc.C) { if runtime.GOOS == "windows" { c.Skip("bug 1403084: Cannot send sigterm on windows") } ctx := context.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) }