Files
kata-containers/src/runtime/virtcontainers/pkg/cgroups/manager_test.go
Eric Ernsteernst d7cb3df0d2 cgroups: Add systemd detection when creating cgroup manager
Look at the provided cgroup path to determine whether systemd is being
used to manage the cgroups. With this, systemd cgroups are being detected
and created appropriately for the sandbox.

Fixes: #599

Signed-off-by: Eric Ernsteernst <eric@amperecomputing.com>

(forward port of https://github.com/kata-containers/runtime/pull/2817)
Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
2021-03-16 08:27:14 +01:00

39 lines
611 B
Go

// Copyright (c) 2020 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package cgroups
import (
"testing"
"github.com/stretchr/testify/assert"
)
//very very basic test; should be expanded
func TestNew(t *testing.T) {
assert := assert.New(t)
// create a cgroupfs cgroup manager
c := &Config{
Cgroups: nil,
CgroupPath: "",
}
mgr, err := New(c)
assert.NoError(err)
assert.NotNil(mgr.mgr)
// create a systemd cgroup manager
s := &Config{
Cgroups: nil,
CgroupPath: "system.slice:kubepod:container",
}
mgr, err = New(s)
assert.NoError(err)
assert.NotNil(mgr.mgr)
}