Commit cbab761a authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: Environment.Cli error tests

parent de444867
......@@ -93,6 +93,18 @@ func TestEnvironment_Builder_Error(t *testing.T) {
assert.Nil(returnedBuilder, "should be no builder")
}
func TestEnvironment_Cli_Error(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
config := DefaultEnvironmentConfig()
config.CommandFunc = func(n string) (Command, error) { return nil, errors.New("foo") }
env, _ := NewEnvironment(config)
_, err := env.Cli([]string{"foo"})
assert.NotNil(err, "should be an error")
assert.Equal(err.Error(), "foo", "should be correct error")
}
func TestEnvironment_Cli_CallsRun(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment