diff --git a/builder/proxmox/common/config_test.go b/builder/proxmox/common/config_test.go index ad58e22b..50cbc39d 100644 --- a/builder/proxmox/common/config_test.go +++ b/builder/proxmox/common/config_test.go @@ -236,11 +236,11 @@ func TestISOs(t *testing.T) { var config Config _, _, err := config.Prepare(&config, cfg) - if c.expectedToFail == true && err == nil { + if c.expectedToFail && err == nil { t.Error("expected config preparation to fail, but no error occured") } - if c.expectedToFail == false && err != nil { + if !c.expectedToFail && err != nil { t.Errorf("expected config preparation to succeed, but %s", err.Error()) } }) @@ -318,11 +318,11 @@ func TestDeprecatedISOOptionsAreConverted(t *testing.T) { t.Errorf("Expected device to be converted to index %s", index) } - if c.expectedToFail == true && err == nil { + if c.expectedToFail && err == nil { t.Error("expected config preparation to fail, but no error occured") } - if c.expectedToFail == false && err != nil { + if !c.expectedToFail && err != nil { t.Errorf("expected config preparation to succeed, but %s", err.Error()) } diff --git a/builder/proxmox/common/step_start_vm_test.go b/builder/proxmox/common/step_start_vm_test.go index 602e4178..a228778b 100644 --- a/builder/proxmox/common/step_start_vm_test.go +++ b/builder/proxmox/common/step_start_vm_test.go @@ -700,6 +700,28 @@ func TestGenerateProxmoxDisks(t *testing.T) { }, }, }, + { + "overallocate ide, should error", + []diskConfig{ + { + Type: "ide", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + }, + []ISOsConfig{}, + []string{ + "ide0", + "ide1", + "ide2", + "ide3", + }, + true, + &proxmox.QemuStorages{}, + }, { "overallocate sata, should error", []diskConfig{ @@ -756,6 +778,212 @@ func TestGenerateProxmoxDisks(t *testing.T) { true, &proxmox.QemuStorages{}, }, + { + "overallocate scsi, should error", + []diskConfig{ + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "scsi", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + }, + []ISOsConfig{ + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + { + Type: "scsi", + ISOFile: "local:iso/test.iso", + }, + }, + []string{ + "scsi0", + "scsi1", + "scsi2", + "scsi3", + "scsi4", + "scsi5", + "scsi6", + "scsi7", + "scsi8", + "scsi9", + "scsi10", + "scsi11", + }, + true, + &proxmox.QemuStorages{}, + }, + { + "overallocate virtio, should error", + []diskConfig{ + { + Type: "virtio", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "virtio", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "virtio", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + { + Type: "virtio", + StoragePool: "local-lvm", + Size: "11G", + CacheMode: "none", + DiskFormat: "qcow2", + IOThread: true, + }, + }, + []ISOsConfig{}, + []string{ + "virtio0", + "virtio1", + "virtio2", + "virtio3", + "virtio4", + "virtio5", + "virtio6", + "virtio7", + "virtio8", + "virtio9", + "virtio10", + "virtio11", + "virtio12", + }, + true, + &proxmox.QemuStorages{}, + }, { "bunch of disks, should be defined in the discovery order", []diskConfig{