forked from moby/hyperkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hyperkit_test.go
44 lines (36 loc) · 1.45 KB
/
hyperkit_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package hyperkit
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLegacyConsole(t *testing.T) {
h, err := New("sh", "", "state-dir")
require.Nil(t, err)
h.Console = ConsoleFile
h.buildArgs("")
assert.EqualValues(t, []string{"-A", "-u", "-F", "state-dir/hyperkit.pid", "-c", "1", "-m", "1024M", "-s", "0:0,hostbridge", "-s", "31,lpc", "-s", "1,virtio-rnd", "-l", "com1,autopty=state-dir/tty,log=state-dir/console-ring", "-f", "kexec,,,earlyprintk=serial "}, h.Arguments)
}
func TestNewSerial(t *testing.T) {
h, err := New("sh", "", "state-dir")
require.Nil(t, err)
h.Serials = []Serial{
{
InteractiveConsole: TTYInteractiveConsole,
LogToRingBuffer: true,
},
}
h.buildArgs("")
assert.EqualValues(t, []string{"-A", "-u", "-F", "state-dir/hyperkit.pid", "-c", "1", "-m", "1024M", "-s", "0:0,hostbridge", "-s", "31,lpc", "-s", "1,virtio-rnd", "-l", "com1,autopty=state-dir/tty1,log=state-dir/console-ring", "-f", "kexec,,,earlyprintk=serial "}, h.Arguments)
}
func TestNullSerial(t *testing.T) {
h, err := New("sh", "", "state-dir")
require.Nil(t, err)
h.Serials = []Serial{
{
LogToRingBuffer: true,
},
}
h.buildArgs("")
assert.EqualValues(t, []string{"-A", "-u", "-F", "state-dir/hyperkit.pid", "-c", "1", "-m", "1024M", "-s", "0:0,hostbridge", "-s", "31,lpc", "-s", "1,virtio-rnd", "-l", "com1,null,log=state-dir/console-ring", "-f", "kexec,,,earlyprintk=serial "}, h.Arguments)
}