mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-24 01:24:26 +01:00
qemu: Add a NetDevice slice to the Config structure
The NetDevice structure represents a network device to be emulated by qemu. We also add the corresponding unit test. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
21
qemu_test.go
21
qemu_test.go
@@ -81,6 +81,13 @@ func testAppend(structure interface{}, expected string, t *testing.T) {
|
||||
}
|
||||
|
||||
params = appendQMPSocket([]string{}, config)
|
||||
|
||||
case NetDevice:
|
||||
config := Config{
|
||||
NetDevices: []NetDevice{s},
|
||||
}
|
||||
|
||||
params = appendNetDevices([]string{}, config)
|
||||
}
|
||||
|
||||
result := strings.Join(params, " ")
|
||||
@@ -258,3 +265,17 @@ func TestAppendStrings(t *testing.T) {
|
||||
t.Fatalf("Failed to append parameters [%s] != [%s]", result, qemuString)
|
||||
}
|
||||
}
|
||||
|
||||
var netdevString = "-netdev tap,id=ceth0,ifname=ceth0,downscript=no,script=no"
|
||||
|
||||
func TestAppendNetDevices(t *testing.T) {
|
||||
netdev := NetDevice{
|
||||
Type: "tap",
|
||||
ID: "ceth0",
|
||||
IfName: "ceth0",
|
||||
Script: "no",
|
||||
DownScript: "no",
|
||||
}
|
||||
|
||||
testAppend(netdev, netdevString, t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user