github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/cmd/jujud/reboot/reboot_windows_test.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Copyright 2014 Cloudbase Solutions SRL 3 // Licensed under the AGPLv3, see LICENCE file for details. 4 5 package reboot_test 6 7 import ( 8 "github.com/juju/testing" 9 jc "github.com/juju/testing/checkers" 10 gc "gopkg.in/check.v1" 11 12 "github.com/juju/juju/apiserver/params" 13 "github.com/juju/juju/cmd/jujud/reboot" 14 ) 15 16 const ( 17 rebootBin = "shutdown.exe" 18 rebootTime = "15" 19 ) 20 21 func (s *RebootSuite) rebootCommandParams(c *gc.C) []string { 22 return []string{ 23 "-f", 24 "-r", 25 "-t", 26 rebootTime, 27 } 28 } 29 30 func (s *RebootSuite) shutdownCommandParams(c *gc.C) []string { 31 return []string{ 32 "-f", 33 "-s", 34 "-t", 35 rebootTime, 36 } 37 } 38 39 func (s *RebootSuite) TestRebootNoContainers(c *gc.C) { 40 w, err := reboot.NewRebootWaiter(s.st, s.acfg) 41 c.Assert(err, jc.ErrorIsNil) 42 expectedRebootParams := s.rebootCommandParams(c) 43 44 err = w.ExecuteReboot(params.ShouldReboot) 45 c.Assert(err, jc.ErrorIsNil) 46 testing.AssertEchoArgs(c, rebootBin, expectedRebootParams...) 47 } 48 49 func (s *RebootSuite) TestShutdownNoContainers(c *gc.C) { 50 w, err := reboot.NewRebootWaiter(s.st, s.acfg) 51 c.Assert(err, jc.ErrorIsNil) 52 expectedShutdownParams := s.shutdownCommandParams(c) 53 54 err = w.ExecuteReboot(params.ShouldShutdown) 55 c.Assert(err, jc.ErrorIsNil) 56 testing.AssertEchoArgs(c, rebootBin, expectedShutdownParams...) 57 }