qemu: Clarify test with bad machine type

The last stanza of TestQemuAmd64Bridges is rather odd.  It tries to create
a qemu instance with a machine type of (QemuQ35 + QemuPC), or in other
words "q35pc", which isn't a thing.

What it's asserting about this is that the returned bridges list is empty
despite asking for bridges, so it looks like what this is really trying to
test is for sane behaviour when given a bad machine type.

So, split this out into a separate test, and make it explicit for clarity.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2020-06-23 15:17:51 +10:00
parent b1a1d8e500
commit d6e7a58ac9

View File

@ -27,6 +27,15 @@ func newTestQemu(machineType string) qemuArch {
return newQemuArch(config)
}
func TestQemuAmd64BadMachineType(t *testing.T) {
assert := assert.New(t)
amd64 := newTestQemu("no-such-machine-type")
amd64.bridges(5)
bridges := amd64.getBridges()
assert.Nil(bridges)
}
func TestQemuAmd64Capabilities(t *testing.T) {
assert := assert.New(t)
@ -66,11 +75,6 @@ func TestQemuAmd64Bridges(t *testing.T) {
assert.Equal(id, b.ID)
assert.NotNil(b.Devices)
}
amd64 = newTestQemu(QemuQ35 + QemuPC)
amd64.bridges(uint32(len))
bridges = amd64.getBridges()
assert.Nil(bridges)
}
func TestQemuAmd64CPUModel(t *testing.T) {