github.com/rentongzhang/docker@v1.8.2-rc1/daemon/utils_test.go (about)

     1  // +build linux
     2  
     3  package daemon
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/docker/docker/runconfig"
     9  )
    10  
    11  func TestMergeLxcConfig(t *testing.T) {
    12  	kv := []runconfig.KeyValuePair{
    13  		{"lxc.cgroups.cpuset", "1,2"},
    14  	}
    15  	hostConfig := &runconfig.HostConfig{
    16  		LxcConf: runconfig.NewLxcConfig(kv),
    17  	}
    18  
    19  	out, err := mergeLxcConfIntoOptions(hostConfig)
    20  	if err != nil {
    21  		t.Fatalf("Failed to merge Lxc Config: %s", err)
    22  	}
    23  
    24  	cpuset := out[0]
    25  	if expected := "cgroups.cpuset=1,2"; cpuset != expected {
    26  		t.Fatalf("expected %s got %s", expected, cpuset)
    27  	}
    28  }