2013-12-21 17:27:00 -05:00
|
|
|
package iso
|
2013-06-11 18:12:45 -04:00
|
|
|
|
|
|
|
import (
|
2014-05-04 11:56:57 -04:00
|
|
|
"github.com/mitchellh/packer/builder/virtualbox/common"
|
2013-06-11 18:12:45 -04:00
|
|
|
"github.com/mitchellh/packer/packer"
|
2013-06-23 23:58:22 -04:00
|
|
|
"reflect"
|
2013-06-11 18:12:45 -04:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testConfig() map[string]interface{} {
|
2013-06-11 23:00:30 -04:00
|
|
|
return map[string]interface{}{
|
2013-07-14 02:50:34 -04:00
|
|
|
"iso_checksum": "foo",
|
|
|
|
"iso_checksum_type": "md5",
|
|
|
|
"iso_url": "http://www.google.com/",
|
2013-11-03 00:17:21 -04:00
|
|
|
"shutdown_command": "yes",
|
2013-07-14 02:50:34 -04:00
|
|
|
"ssh_username": "foo",
|
2013-07-01 14:11:31 -04:00
|
|
|
|
|
|
|
packer.BuildNameConfigKey: "foo",
|
2013-06-11 23:00:30 -04:00
|
|
|
}
|
2013-06-11 18:12:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
|
|
|
var raw interface{}
|
|
|
|
raw = &Builder{}
|
|
|
|
if _, ok := raw.(packer.Builder); !ok {
|
|
|
|
t.Error("Builder must implement builder.")
|
|
|
|
}
|
|
|
|
}
|
2013-06-11 18:57:20 -04:00
|
|
|
|
|
|
|
func TestBuilderPrepare_Defaults(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-11 18:57:20 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
2014-05-04 11:56:57 -04:00
|
|
|
if b.config.GuestAdditionsMode != common.GuestAdditionsModeUpload {
|
2013-11-02 04:22:56 -04:00
|
|
|
t.Errorf("bad guest additions mode: %s", b.config.GuestAdditionsMode)
|
|
|
|
}
|
|
|
|
|
2013-06-11 18:57:20 -04:00
|
|
|
if b.config.GuestOSType != "Other" {
|
|
|
|
t.Errorf("bad guest OS type: %s", b.config.GuestOSType)
|
|
|
|
}
|
|
|
|
|
2013-07-01 14:11:31 -04:00
|
|
|
if b.config.VMName != "packer-foo" {
|
2013-06-11 19:12:19 -04:00
|
|
|
t.Errorf("bad vm name: %s", b.config.VMName)
|
|
|
|
}
|
2013-08-19 14:21:36 -04:00
|
|
|
|
|
|
|
if b.config.Format != "ovf" {
|
|
|
|
t.Errorf("bad format: %s", b.config.Format)
|
|
|
|
}
|
2013-06-11 18:57:20 -04:00
|
|
|
}
|
2013-06-11 23:00:30 -04:00
|
|
|
|
2013-06-23 23:43:40 -04:00
|
|
|
func TestBuilderPrepare_DiskSize(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
delete(config, "disk_size")
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-23 23:43:40 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("bad err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.DiskSize != 40000 {
|
|
|
|
t.Fatalf("bad size: %d", b.config.DiskSize)
|
|
|
|
}
|
|
|
|
|
|
|
|
config["disk_size"] = 60000
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-23 23:43:40 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.DiskSize != 60000 {
|
|
|
|
t.Fatalf("bad size: %s", b.config.DiskSize)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-02 04:22:56 -04:00
|
|
|
func TestBuilderPrepare_GuestAdditionsMode(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
// test default mode
|
|
|
|
delete(config, "guest_additions_mode")
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-11-02 04:22:56 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("bad err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test another mode
|
|
|
|
config["guest_additions_mode"] = "attach"
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-11-02 04:22:56 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
2014-05-04 11:56:57 -04:00
|
|
|
if b.config.GuestAdditionsMode != common.GuestAdditionsModeAttach {
|
2013-11-02 04:22:56 -04:00
|
|
|
t.Fatalf("bad: %s", b.config.GuestAdditionsMode)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test bad mode
|
|
|
|
config["guest_additions_mode"] = "teleport"
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-11-02 04:22:56 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should error")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-24 02:05:32 -04:00
|
|
|
func TestBuilderPrepare_GuestAdditionsPath(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
2013-07-07 12:09:22 -04:00
|
|
|
delete(config, "guest_additions_path")
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-24 02:05:32 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("bad err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.GuestAdditionsPath != "VBoxGuestAdditions.iso" {
|
|
|
|
t.Fatalf("bad: %s", b.config.GuestAdditionsPath)
|
|
|
|
}
|
|
|
|
|
|
|
|
config["guest_additions_path"] = "foo"
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-24 02:05:32 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.GuestAdditionsPath != "foo" {
|
|
|
|
t.Fatalf("bad size: %s", b.config.GuestAdditionsPath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-07 12:14:16 -04:00
|
|
|
func TestBuilderPrepare_GuestAdditionsSHA256(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
delete(config, "guest_additions_sha256")
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-07 12:14:16 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("bad err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.GuestAdditionsSHA256 != "" {
|
|
|
|
t.Fatalf("bad: %s", b.config.GuestAdditionsSHA256)
|
|
|
|
}
|
|
|
|
|
|
|
|
config["guest_additions_sha256"] = "FOO"
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-07 12:14:16 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.GuestAdditionsSHA256 != "foo" {
|
|
|
|
t.Fatalf("bad size: %s", b.config.GuestAdditionsSHA256)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBuilderPrepare_GuestAdditionsURL(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
config["guest_additions_url"] = ""
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-07 12:14:16 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.GuestAdditionsURL != "" {
|
|
|
|
t.Fatalf("should be empty: %s", b.config.GuestAdditionsURL)
|
|
|
|
}
|
|
|
|
|
|
|
|
config["guest_additions_url"] = "http://www.packer.io"
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-07 12:14:16 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-05 15:07:58 -04:00
|
|
|
func TestBuilderPrepare_HardDriveInterface(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
// Test a default boot_wait
|
|
|
|
delete(config, "hard_drive_interface")
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-09-05 15:07:58 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.HardDriveInterface != "ide" {
|
|
|
|
t.Fatalf("bad: %s", b.config.HardDriveInterface)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test with a bad
|
|
|
|
config["hard_drive_interface"] = "fake"
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-09-05 15:07:58 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test with a good
|
|
|
|
config["hard_drive_interface"] = "sata"
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-09-05 15:07:58 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-12 02:44:40 -04:00
|
|
|
func TestBuilderPrepare_HTTPPort(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
// Bad
|
|
|
|
config["http_port_min"] = 1000
|
|
|
|
config["http_port_max"] = 500
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-12 02:44:40 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bad
|
|
|
|
config["http_port_min"] = -500
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-12 02:44:40 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Good
|
|
|
|
config["http_port_min"] = 500
|
|
|
|
config["http_port_max"] = 1000
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-12 02:44:40 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
2013-07-13 20:28:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBuilderPrepare_InvalidKey(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
// Add a random key
|
|
|
|
config["i_should_not_be_valid"] = true
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-13 20:28:56 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
2013-06-12 02:44:40 -04:00
|
|
|
}
|
|
|
|
|
2013-07-14 02:50:34 -04:00
|
|
|
func TestBuilderPrepare_ISOChecksum(t *testing.T) {
|
2013-06-11 23:00:30 -04:00
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
// Test bad
|
2013-07-14 02:50:34 -04:00
|
|
|
config["iso_checksum"] = ""
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-11 23:00:30 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test good
|
2013-07-14 02:50:34 -04:00
|
|
|
config["iso_checksum"] = "FOo"
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-11 23:00:30 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
2013-07-14 02:50:34 -04:00
|
|
|
if b.config.ISOChecksum != "foo" {
|
|
|
|
t.Fatalf("should've lowercased: %s", b.config.ISOChecksum)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
// Test bad
|
|
|
|
config["iso_checksum_type"] = ""
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-14 02:50:34 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test good
|
|
|
|
config["iso_checksum_type"] = "mD5"
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-14 02:50:34 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.ISOChecksumType != "md5" {
|
|
|
|
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test unknown
|
|
|
|
config["iso_checksum_type"] = "fake"
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-07-14 02:50:34 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
2013-06-11 23:00:30 -04:00
|
|
|
}
|
2013-12-28 11:59:47 -05:00
|
|
|
|
|
|
|
// Test none
|
|
|
|
config["iso_checksum_type"] = "none"
|
|
|
|
b = Builder{}
|
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) == 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if b.config.ISOChecksumType != "none" {
|
|
|
|
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
|
|
|
|
}
|
2013-06-11 23:00:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBuilderPrepare_ISOUrl(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
2013-08-15 14:57:29 -04:00
|
|
|
delete(config, "iso_url")
|
|
|
|
delete(config, "iso_urls")
|
2013-06-11 23:00:30 -04:00
|
|
|
|
2013-08-15 14:57:29 -04:00
|
|
|
// Test both epty
|
2013-06-11 23:00:30 -04:00
|
|
|
config["iso_url"] = ""
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err := b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-11 23:00:30 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
2013-08-15 14:57:29 -04:00
|
|
|
// Test iso_url set
|
2013-06-11 23:00:30 -04:00
|
|
|
config["iso_url"] = "http://www.packer.io"
|
2013-08-15 14:57:29 -04:00
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-06-11 23:00:30 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("should not have error: %s", err)
|
|
|
|
}
|
2013-08-15 14:57:29 -04:00
|
|
|
|
|
|
|
expected := []string{"http://www.packer.io"}
|
|
|
|
if !reflect.DeepEqual(b.config.ISOUrls, expected) {
|
|
|
|
t.Fatalf("bad: %#v", b.config.ISOUrls)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test both set
|
|
|
|
config["iso_url"] = "http://www.packer.io"
|
|
|
|
config["iso_urls"] = []string{"http://www.packer.io"}
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-08-15 14:57:29 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test just iso_urls set
|
|
|
|
delete(config, "iso_url")
|
|
|
|
config["iso_urls"] = []string{
|
|
|
|
"http://www.packer.io",
|
|
|
|
"http://www.hashicorp.com",
|
|
|
|
}
|
|
|
|
|
|
|
|
b = Builder{}
|
2013-11-03 00:03:59 -04:00
|
|
|
warns, err = b.Prepare(config)
|
|
|
|
if len(warns) > 0 {
|
|
|
|
t.Fatalf("bad: %#v", warns)
|
|
|
|
}
|
2013-08-15 14:57:29 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("should not have error: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
expected = []string{
|
|
|
|
"http://www.packer.io",
|
|
|
|
"http://www.hashicorp.com",
|
|
|
|
}
|
|
|
|
if !reflect.DeepEqual(b.config.ISOUrls, expected) {
|
|
|
|
t.Fatalf("bad: %#v", b.config.ISOUrls)
|
|
|
|
}
|
2013-06-11 23:00:30 -04:00
|
|
|
}
|