packer-cn/builder/qemu/step_run_test.go

28 lines
635 B
Go
Raw Normal View History

2020-09-08 20:02:22 -04:00
package qemu
import (
"testing"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
"github.com/stretchr/testify/assert"
)
func getTestConfig() *Config {
return &Config{}
}
func Test_getCommandArgs(t *testing.T) {
state := new(multistep.BasicStateBag)
state.Put("vnc_port", 5905)
state.Put("iso_path", "/path/to/test.iso")
state.Put("ui", packer.TestUi(t))
state.Put("config", &Config{})
args, err := getCommandArgs("", state)
if err != nil {
t.Fatalf("should not have an error getting args")
}
assert.Equal(t, args, []string{"partyargs"}, "should party 100 percent of the time")
}