github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/cgroups/manager_test.go (about)

     1  // Copyright (c) 2020 Intel Corporation
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  //
     5  
     6  package cgroups
     7  
     8  import (
     9  	"testing"
    10  
    11  	"github.com/stretchr/testify/assert"
    12  )
    13  
    14  //very very basic test; should be expanded
    15  func TestNew(t *testing.T) {
    16  	assert := assert.New(t)
    17  
    18  	// create a cgroupfs cgroup manager
    19  	c := &Config{
    20  		Cgroups:    nil,
    21  		CgroupPath: "",
    22  	}
    23  
    24  	mgr, err := New(c)
    25  	assert.NoError(err)
    26  	assert.NotNil(mgr.mgr)
    27  
    28  	// create a systemd cgroup manager
    29  	s := &Config{
    30  		Cgroups:    nil,
    31  		CgroupPath: "system.slice:kubepod:container",
    32  	}
    33  
    34  	mgr, err = New(s)
    35  	assert.NoError(err)
    36  	assert.NotNil(mgr.mgr)
    37  
    38  }