diff --git a/integration/exec_test.go b/integration/exec_test.go index 4afff77d..b5a34b5e 100644 --- a/integration/exec_test.go +++ b/integration/exec_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/docker/libcontainer" + "github.com/docker/libcontainer/cgroups/systemd" "github.com/docker/libcontainer/configs" ) @@ -481,6 +482,17 @@ func TestProcessCaps(t *testing.T) { } func TestFreeze(t *testing.T) { + testFreeze(t, false) +} + +func TestSystemdFreeze(t *testing.T) { + if !systemd.UseSystemd() { + t.Skip("Systemd is unsupported") + } + testFreeze(t, true) +} + +func testFreeze(t *testing.T, systemd bool) { if testing.Short() { return } @@ -497,6 +509,9 @@ func TestFreeze(t *testing.T) { defer remove(rootfs) config := newTemplateConfig(rootfs) + if systemd { + config.Cgroups.Slice = "system.slice" + } factory, err := libcontainer.New(root, libcontainer.Cgroupfs) if err != nil { diff --git a/integration/utils_test.go b/integration/utils_test.go index c444eecf..cf459686 100644 --- a/integration/utils_test.go +++ b/integration/utils_test.go @@ -68,9 +68,14 @@ func copyBusybox(dest string) error { } func newContainer(config *configs.Config) (libcontainer.Container, error) { + cgm := libcontainer.Cgroupfs + if config.Cgroups != nil && config.Cgroups.Slice == "system.slice" { + cgm = libcontainer.SystemdCgroups + } + factory, err := libcontainer.New(".", libcontainer.InitArgs(os.Args[0], "init", "--"), - libcontainer.Cgroupfs, + cgm, ) if err != nil { return nil, err