Files
podman/pkg/cgroups/cgroups_test.go
Daniel J Walsh 89bb8a9b36 Don't fail if one of the cgroups is not setup
It is fairly common for certain cgroups controllers to
not be enabled on a system.  We should Warn when this happens
versus failing, when doing podman stats command.  This way users
can get information from the other controllers.

Fixes: https://github.com/containers/podman/issues/8588

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-27 15:16:24 -05:00

33 lines
563 B
Go

package cgroups
import (
"testing"
"github.com/containers/podman/v2/pkg/rootless"
spec "github.com/opencontainers/runtime-spec/specs-go"
)
func TestCreated(t *testing.T) {
// tests only works in rootless mode
if rootless.IsRootless() {
return
}
var resources spec.LinuxResources
cgr, err := New("machine.slice", &resources)
if err != nil {
t.Error(err)
}
if err := cgr.Delete(); err != nil {
t.Error(err)
}
cgr, err = NewSystemd("machine.slice")
if err != nil {
t.Error(err)
}
if err := cgr.Delete(); err != nil {
t.Error(err)
}
}