github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/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  var rebootBin = "shutdown.exe"
    13  
    14  func (s *RebootSuite) rebootCommandParams(c *gc.C) []string {
    15  	return []string{
    16  		"-r",
    17  		"-t",
    18  		"0",
    19  	}
    20  }
    21  
    22  func (s *RebootSuite) shutdownCommandParams(c *gc.C) []string {
    23  	return []string{
    24  		"-s",
    25  		"-t",
    26  		"0",
    27  	}
    28  }
    29  
    30  func (s *RebootSuite) TestRebootNoContainers(c *gc.C) {
    31  	w, err := reboot.NewRebootWaiter(s.st, s.acfg)
    32  	c.Assert(err, jc.ErrorIsNil)
    33  	expectedRebootParams := s.rebootCommandParams(c)
    34  
    35  	err = w.ExecuteReboot(params.ShouldReboot)
    36  	c.Assert(err, jc.ErrorIsNil)
    37  	testing.AssertEchoArgs(c, rebootBin, expectedRebootParams...)
    38  }
    39  
    40  func (s *RebootSuite) TestShutdownNoContainers(c *gc.C) {
    41  	w, err := reboot.NewRebootWaiter(s.st, s.acfg)
    42  	c.Assert(err, jc.ErrorIsNil)
    43  	expectedShutdownParams := s.shutdownCommandParams(c)
    44  
    45  	err = w.ExecuteReboot(params.ShouldShutdown)
    46  	c.Assert(err, jc.ErrorIsNil)
    47  	testing.AssertEchoArgs(c, rebootBin, expectedShutdownParams...)
    48  }