func (s *HandleSuite) TestTimeoutRun(c *gc.C) {
	params := map[string]interface{}{
		"command": "sleep 100",
		"timeout": float64(1),
	}

	results, err := machineactions.HandleAction(actions.JujuRunActionName, params)
	c.Assert(errors.Cause(err), gc.Equals, exec.ErrCancelled)
	c.Assert(results, gc.IsNil)
}
func (s *HandleSuite) TestErrorRun(c *gc.C) {
	params := map[string]interface{}{
		"command": "exit 42",
		"timeout": float64(0),
	}

	results, err := machineactions.HandleAction(actions.JujuRunActionName, params)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(results["Code"], gc.Equals, "42")
	c.Assert(results["Stdout"], gc.Equals, "")
	c.Assert(results["Stderr"], gc.Equals, "")
}
func (s *HandleSuite) TestSuccessfulRun(c *gc.C) {
	params := map[string]interface{}{
		"command": "echo 1",
		"timeout": float64(0),
	}

	results, err := machineactions.HandleAction(actions.JujuRunActionName, params)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(results["Code"], gc.Equals, "0")
	c.Assert(strings.TrimRight(results["Stdout"].(string), "\r\n"), gc.Equals, "1")
	c.Assert(results["Stderr"], gc.Equals, "")
}
func (s *HandleSuite) TestValidActionInvalidParams(c *gc.C) {
	results, err := machineactions.HandleAction(actions.JujuRunActionName, nil)
	c.Assert(err, gc.ErrorMatches, "invalid action parameters")
	c.Assert(results, gc.IsNil)
}
func (s *HandleSuite) TestInvalidAction(c *gc.C) {
	results, err := machineactions.HandleAction("invalid", nil)
	c.Assert(err, gc.ErrorMatches, "unexpected action invalid")
	c.Assert(results, gc.IsNil)
}