mirror of
https://github.com/containers/podman.git
synced 2025-06-22 09:58:10 +08:00

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>
33 lines
563 B
Go
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)
|
|
}
|
|
}
|