mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 04:34:27 +00:00
qemu: Add one unit test for the Config strings
Here we test that name, UUID and the CPU model are properly built. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
5ba8ef79df
commit
c0e2aacad2
22
qemu_test.go
22
qemu_test.go
@ -236,3 +236,25 @@ func TestAppendQMPSocket(t *testing.T) {
|
|||||||
|
|
||||||
testAppend(qmp, qmpSocketString, t)
|
testAppend(qmp, qmpSocketString, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var qemuString = "-name cc-qemu -cpu host -uuid 123456789"
|
||||||
|
|
||||||
|
func TestAppendStrings(t *testing.T) {
|
||||||
|
var params []string
|
||||||
|
|
||||||
|
config := Config{
|
||||||
|
Path: "qemu",
|
||||||
|
Name: "cc-qemu",
|
||||||
|
UUID: "123456789",
|
||||||
|
CPUModel: "host",
|
||||||
|
}
|
||||||
|
|
||||||
|
params = appendName(params, config)
|
||||||
|
params = appendCPUModel(params, config)
|
||||||
|
params = appendUUID(params, config)
|
||||||
|
|
||||||
|
result := strings.Join(params, " ")
|
||||||
|
if result != qemuString {
|
||||||
|
t.Fatalf("Failed to append parameters [%s] != [%s]", result, qemuString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user