use helper method for mandatory config
This commit is contained in:
parent
adf1e29459
commit
a65157a91b
|
@ -146,39 +146,21 @@ func TestBasicExampleFromDocsIsValid(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAgentSetToFalse(t *testing.T) {
|
func TestAgentSetToFalse(t *testing.T) {
|
||||||
// only the mandatory attributes are specified
|
cfg := mandatoryConfig(t)
|
||||||
const config = `{
|
cfg["qemu_agent"] = false
|
||||||
"builders": [
|
|
||||||
{
|
|
||||||
"type": "proxmox",
|
|
||||||
"proxmox_url": "https://my-proxmox.my-domain:8006/api2/json",
|
|
||||||
"username": "apiuser@pve",
|
|
||||||
"password": "supersecret",
|
|
||||||
"iso_file": "local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso",
|
|
||||||
"ssh_username": "root",
|
|
||||||
"node": "my-proxmox",
|
|
||||||
"qemu_agent": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}`
|
|
||||||
|
|
||||||
tpl, err := template.Parse(strings.NewReader(config))
|
var c Config
|
||||||
if err != nil {
|
warn, err := c.Prepare(cfg)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
b := &Builder{}
|
|
||||||
_, warn, err := b.Prepare(tpl.Builders["proxmox"].Config)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err, warn)
|
t.Fatal(err, warn)
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.config.Agent != false {
|
if c.Agent != false {
|
||||||
t.Errorf("Expected Agent to be false, got %t", b.config.Agent)
|
t.Errorf("Expected Agent to be false, got %t", c.Agent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNetworkAdapterPacketQueueSupport(t *testing.T) {
|
func TestPacketQueueSupportForNetworkAdapters(t *testing.T) {
|
||||||
drivertests := []struct {
|
drivertests := []struct {
|
||||||
expectedToFail bool
|
expectedToFail bool
|
||||||
model string
|
model string
|
||||||
|
|
Loading…
Reference in New Issue