mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
qemu: Add a Knobs unit test
We test that all true and all false knobs parameters are properly built. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
8aeb3d45aa
commit
8e495f6eff
29
qemu_test.go
29
qemu_test.go
@ -46,6 +46,13 @@ func testAppend(structure interface{}, expected string, t *testing.T) {
|
||||
}
|
||||
|
||||
params = appendObjects([]string{}, config)
|
||||
|
||||
case Knobs:
|
||||
config := Config{
|
||||
Knobs: s,
|
||||
}
|
||||
|
||||
params = appendKnobs([]string{}, config)
|
||||
}
|
||||
|
||||
result := strings.Join(params, " ")
|
||||
@ -119,3 +126,25 @@ func TestAppendEmptyObject(t *testing.T) {
|
||||
|
||||
testAppend(device, "", t)
|
||||
}
|
||||
|
||||
var knobsString = "-no-user-config -nodefaults -nographic"
|
||||
|
||||
func TestAppendKnobsAllTrue(t *testing.T) {
|
||||
knobs := Knobs{
|
||||
NoUserConfig: true,
|
||||
NoDefaults: true,
|
||||
NoGraphic: true,
|
||||
}
|
||||
|
||||
testAppend(knobs, knobsString, t)
|
||||
}
|
||||
|
||||
func TestAppendKnobsAllFalse(t *testing.T) {
|
||||
knobs := Knobs{
|
||||
NoUserConfig: false,
|
||||
NoDefaults: false,
|
||||
NoGraphic: false,
|
||||
}
|
||||
|
||||
testAppend(knobs, "", t)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user