Files
docker-cli/components/engine/daemon/execdriver/lxc/info_test.go
John Howard 74df4d944e Windows: Factor out LXC
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 10e2dbf375b1aebe33bce0646a3a95d34c48d4f8
Component: engine
2015-04-30 14:28:35 -07:00

39 lines
587 B
Go

// +build linux
package lxc
import (
"testing"
)
func TestParseRunningInfo(t *testing.T) {
raw := `
state: RUNNING
pid: 50`
info, err := parseLxcInfo(raw)
if err != nil {
t.Fatal(err)
}
if !info.Running {
t.Fatal("info should return a running state")
}
if info.Pid != 50 {
t.Fatalf("info should have pid 50 got %d", info.Pid)
}
}
func TestEmptyInfo(t *testing.T) {
_, err := parseLxcInfo("")
if err == nil {
t.Fatal("error should not be nil")
}
}
func TestBadInfo(t *testing.T) {
_, err := parseLxcInfo("state")
if err != nil {
t.Fatal(err)
}
}