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 36
|
package fs
import (
"strings"
"testing"
"github.com/opencontainers/cgroups"
"github.com/opencontainers/cgroups/fscommon"
)
var prioMap = []*cgroups.IfPrioMap{
{
Interface: "test",
Priority: 5,
},
}
func TestNetPrioSetIfPrio(t *testing.T) {
path := tempDir(t, "net_prio")
r := &cgroups.Resources{
NetPrioIfpriomap: prioMap,
}
netPrio := &NetPrioGroup{}
if err := netPrio.Set(path, r); err != nil {
t.Fatal(err)
}
value, err := fscommon.GetCgroupParamString(path, "net_prio.ifpriomap")
if err != nil {
t.Fatal(err)
}
if !strings.Contains(value, "test 5") {
t.Fatal("Got the wrong value, set net_prio.ifpriomap failed.")
}
}
|