Fix virtualbox-iso TestBuilderAcc_basic (#8481)
make sure the test works for later usage
This commit is contained in:
parent
822aa02500
commit
c6b9efb522
|
@ -1,30 +1,22 @@
|
||||||
package iso
|
package iso
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilderAcc_basic(t *testing.T) {
|
func TestBuilderAcc_basic(t *testing.T) {
|
||||||
|
templatePath := filepath.Join("testdata", "minimal.json")
|
||||||
|
bytes, err := ioutil.ReadFile(templatePath)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to load template file %s", templatePath)
|
||||||
|
}
|
||||||
|
|
||||||
builderT.Test(t, builderT.TestCase{
|
builderT.Test(t, builderT.TestCase{
|
||||||
Builder: &Builder{},
|
Builder: &Builder{},
|
||||||
Template: testBuilderAccBasic,
|
Template: string(bytes),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const testBuilderAccBasic = `
|
|
||||||
{
|
|
||||||
"builders": [{
|
|
||||||
"type": "test",
|
|
||||||
"guest_os_type": "Ubuntu_64",
|
|
||||||
"iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso",
|
|
||||||
"iso_checksum": "769474248a3897f4865817446f9a4a53",
|
|
||||||
"iso_checksum_type": "md5",
|
|
||||||
"ssh_username": "packer",
|
|
||||||
"ssh_password": "packer",
|
|
||||||
"ssh_wait_timeout": "30s",
|
|
||||||
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
# Preseeding only locale sets language, country and locale.
|
||||||
|
d-i debian-installer/locale string en_US
|
||||||
|
|
||||||
|
# Keyboard selection.
|
||||||
|
d-i console-setup/ask_detect boolean false
|
||||||
|
d-i keyboard-configuration/xkb-keymap select us
|
||||||
|
|
||||||
|
choose-mirror-bin mirror/http/proxy string
|
||||||
|
d-i base-installer/kernel/override-image string linux-server
|
||||||
|
d-i clock-setup/utc boolean true
|
||||||
|
d-i clock-setup/utc-auto boolean true
|
||||||
|
d-i finish-install/reboot_in_progress note
|
||||||
|
d-i grub-installer/only_debian boolean true
|
||||||
|
d-i grub-installer/with_other_os boolean true
|
||||||
|
d-i mirror/country string manual
|
||||||
|
d-i mirror/http/directory string /ubuntu/
|
||||||
|
d-i mirror/http/hostname string archive.ubuntu.com
|
||||||
|
d-i mirror/http/proxy string
|
||||||
|
d-i partman-auto-lvm/guided_size string max
|
||||||
|
d-i partman-auto/choose_recipe select atomic
|
||||||
|
d-i partman-auto/method string lvm
|
||||||
|
d-i partman-lvm/confirm boolean true
|
||||||
|
d-i partman-lvm/confirm boolean true
|
||||||
|
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||||
|
d-i partman-lvm/device_remove_lvm boolean true
|
||||||
|
d-i partman/choose_partition select finish
|
||||||
|
d-i partman/confirm boolean true
|
||||||
|
d-i partman/confirm_nooverwrite boolean true
|
||||||
|
d-i partman/confirm_write_new_label boolean true
|
||||||
|
d-i passwd/user-fullname string vagrant
|
||||||
|
d-i passwd/user-uid string 1000
|
||||||
|
d-i passwd/user-password password vagrant
|
||||||
|
d-i passwd/user-password-again password vagrant
|
||||||
|
d-i passwd/username string vagrant
|
||||||
|
d-i pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-kernel-server nfs-common linux-headers-$(uname -r) perl
|
||||||
|
d-i pkgsel/install-language-support boolean false
|
||||||
|
d-i pkgsel/update-policy select none
|
||||||
|
d-i pkgsel/upgrade select full-upgrade
|
||||||
|
d-i time/zone string UTC
|
||||||
|
d-i user-setup/allow-password-weak boolean true
|
||||||
|
d-i user-setup/encrypt-home boolean false
|
||||||
|
tasksel tasksel/first multiselect standard, server
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"builders": [
|
||||||
|
{
|
||||||
|
"type": "test",
|
||||||
|
"iso_checksum": "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2",
|
||||||
|
"iso_checksum_type": "sha256",
|
||||||
|
"iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso",
|
||||||
|
"disk_size": "40960",
|
||||||
|
"guest_os_type": "Ubuntu_64",
|
||||||
|
|
||||||
|
"ssh_password": "vagrant",
|
||||||
|
"ssh_username": "vagrant",
|
||||||
|
"ssh_wait_timeout": "10000s",
|
||||||
|
|
||||||
|
"http_directory": "./testdata/http",
|
||||||
|
"boot_wait": "10s",
|
||||||
|
"boot_command": [
|
||||||
|
"<esc><wait>",
|
||||||
|
"<esc><wait>",
|
||||||
|
"<enter><wait>",
|
||||||
|
"/install/vmlinuz<wait>",
|
||||||
|
" auto<wait>",
|
||||||
|
" console-setup/ask_detect=false<wait>",
|
||||||
|
" console-setup/layoutcode=us<wait>",
|
||||||
|
" console-setup/modelcode=pc105<wait>",
|
||||||
|
" debconf/frontend=noninteractive<wait>",
|
||||||
|
" debian-installer=en_US.UTF-8<wait>",
|
||||||
|
" fb=false<wait>",
|
||||||
|
" initrd=/install/initrd.gz<wait>",
|
||||||
|
" kbd-chooser/method=us<wait>",
|
||||||
|
" keyboard-configuration/layout=USA<wait>",
|
||||||
|
" keyboard-configuration/variant=USA<wait>",
|
||||||
|
" locale=en_US.UTF-8<wait>",
|
||||||
|
" netcfg/get_domain=vm<wait>",
|
||||||
|
" netcfg/get_hostname=vagrant<wait>",
|
||||||
|
" noapic<wait>",
|
||||||
|
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
|
||||||
|
" -- <wait>",
|
||||||
|
"<enter><wait>"
|
||||||
|
],
|
||||||
|
|
||||||
|
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
|
||||||
|
"post_shutdown_delay": "60s"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue