github.com/Pankov404/juju@v0.0.0-20150703034450-be266991dceb/cmd/jujud/reboot/reboot_windows_test.go (about)

     1  package reboot_test
     2  
     3  import (
     4  	"github.com/juju/testing"
     5  	jc "github.com/juju/testing/checkers"
     6  	gc "gopkg.in/check.v1"
     7  
     8  	"github.com/juju/juju/apiserver/params"
     9  	"github.com/juju/juju/cmd/jujud/reboot"
    10  )
    11  
    12  const (
    13  	rebootBin  = "shutdown.exe"
    14  	rebootTime = "15"
    15  )
    16  
    17  func (s *RebootSuite) rebootCommandParams(c *gc.C) []string {
    18  	return []string{
    19  		"-r",
    20  		"-t",
    21  		rebootTime,
    22  	}
    23  }
    24  
    25  func (s *RebootSuite) shutdownCommandParams(c *gc.C) []string {
    26  	return []string{
    27  		"-s",
    28  		"-t",
    29  		rebootTime,
    30  	}
    31  }
    32  
    33  func (s *RebootSuite) TestRebootNoContainers(c *gc.C) {
    34  	w, err := reboot.NewRebootWaiter(s.st, s.acfg)
    35  	c.Assert(err, jc.ErrorIsNil)
    36  	expectedRebootParams := s.rebootCommandParams(c)
    37  
    38  	err = w.ExecuteReboot(params.ShouldReboot)
    39  	c.Assert(err, jc.ErrorIsNil)
    40  	testing.AssertEchoArgs(c, rebootBin, expectedRebootParams...)
    41  }
    42  
    43  func (s *RebootSuite) TestShutdownNoContainers(c *gc.C) {
    44  	w, err := reboot.NewRebootWaiter(s.st, s.acfg)
    45  	c.Assert(err, jc.ErrorIsNil)
    46  	expectedShutdownParams := s.shutdownCommandParams(c)
    47  
    48  	err = w.ExecuteReboot(params.ShouldShutdown)
    49  	c.Assert(err, jc.ErrorIsNil)
    50  	testing.AssertEchoArgs(c, rebootBin, expectedShutdownParams...)
    51  }