File: cgroups_test.go

package info (click to toggle)
golang-github-containers-common 0.56.0%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,852 kB
  • sloc: makefile: 126; sh: 62
file content (35 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//go:build !linux
// +build !linux

package cgroups

import (
	"testing"

	"github.com/containers/storage/pkg/unshare"
	spec "github.com/opencontainers/runtime-spec/specs-go"
)

func TestCreated(t *testing.T) {
	// tests only works in rootless mode
	if unshare.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)
	}
}