diff --git a/libcontainer/configs/config_test.go b/libcontainer/configs/config_test.go index 765d5e50..385e3775 100644 --- a/libcontainer/configs/config_test.go +++ b/libcontainer/configs/config_test.go @@ -75,101 +75,6 @@ func loadConfig(name string) (*Config, error) { return container, nil } -func TestConfigJsonFormat(t *testing.T) { - container, err := loadConfig("attach_to_bridge.json") - if err != nil { - t.Fatal(err) - } - - if container.Hostname != "koye" { - t.Log("hostname is not set") - t.Fail() - } - - if !container.Namespaces.Contains(NEWNET) { - t.Log("namespaces should contain NEWNET") - t.Fail() - } - - if container.Namespaces.Contains(NEWUSER) { - t.Log("namespaces should not contain NEWUSER") - t.Fail() - } - - if contains("SYS_ADMIN", container.Capabilities) { - t.Log("SYS_ADMIN should not be enabled in capabilities mask") - t.Fail() - } - - if !contains("MKNOD", container.Capabilities) { - t.Log("MKNOD should be enabled in capabilities mask") - t.Fail() - } - - if !contains("SYS_CHROOT", container.Capabilities) { - t.Log("capabilities mask should contain SYS_CHROOT") - t.Fail() - } - - for _, n := range container.Networks { - if n.Type == "veth" { - if n.Bridge != "docker0" { - t.Logf("veth bridge should be docker0 but received %q", n.Bridge) - t.Fail() - } - - if n.Address != "172.17.0.101/16" { - t.Logf("veth address should be 172.17.0.101/61 but received %q", n.Address) - t.Fail() - } - - if n.Gateway != "172.17.42.1" { - t.Logf("veth gateway should be 172.17.42.1 but received %q", n.Gateway) - t.Fail() - } - - if n.Mtu != 1500 { - t.Logf("veth mtu should be 1500 but received %d", n.Mtu) - t.Fail() - } - - break - } - } - for _, d := range DefaultSimpleDevices { - if !containsDevice(d, container.Devices) { - t.Logf("expected device configuration for %s", d.Path) - t.Fail() - } - } -} - -func TestApparmorProfile(t *testing.T) { - container, err := loadConfig("apparmor.json") - if err != nil { - t.Fatal(err) - } - - if container.AppArmorProfile != "docker-default" { - t.Fatalf("expected apparmor profile to be docker-default but received %q", container.AppArmorProfile) - } -} - -func TestSelinuxLabels(t *testing.T) { - container, err := loadConfig("selinux.json") - if err != nil { - t.Fatal(err) - } - label := "system_u:system_r:svirt_lxc_net_t:s0:c164,c475" - - if container.ProcessLabel != label { - t.Fatalf("expected process label %q but received %q", label, container.ProcessLabel) - } - if container.MountLabel != label { - t.Fatalf("expected mount label %q but received %q", label, container.MountLabel) - } -} - func TestRemoveNamespace(t *testing.T) { ns := Namespaces{ {Type: NEWNET},