mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-26 19:41:35 +08:00

gofumpt (mvdan.cc/gofumpt) is a fork of gofmt with stricter rules. Brought to you by git ls-files \*.go | grep -v ^vendor/ | xargs gofumpt -s -w Looking at the diff, all these changes make sense. Also, replace gofmt with gofumpt in golangci.yml. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
38 lines
855 B
Go
38 lines
855 B
Go
// +build linux
|
|
|
|
package fs
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/opencontainers/runc/libcontainer/cgroups/fscommon"
|
|
"github.com/opencontainers/runc/libcontainer/configs"
|
|
)
|
|
|
|
var prioMap = []*configs.IfPrioMap{
|
|
{
|
|
Interface: "test",
|
|
Priority: 5,
|
|
},
|
|
}
|
|
|
|
func TestNetPrioSetIfPrio(t *testing.T) {
|
|
helper := NewCgroupTestUtil("net_prio", t)
|
|
defer helper.cleanup()
|
|
|
|
helper.CgroupData.config.Resources.NetPrioIfpriomap = prioMap
|
|
netPrio := &NetPrioGroup{}
|
|
if err := netPrio.Set(helper.CgroupPath, helper.CgroupData.config.Resources); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
value, err := fscommon.GetCgroupParamString(helper.CgroupPath, "net_prio.ifpriomap")
|
|
if err != nil {
|
|
t.Fatalf("Failed to parse net_prio.ifpriomap - %s", err)
|
|
}
|
|
if !strings.Contains(value, "test 5") {
|
|
t.Fatal("Got the wrong value, set net_prio.ifpriomap failed.")
|
|
}
|
|
}
|