utils_test.go 640 B

1234567891011121314151617181920212223242526272829
  1. package daemon
  2. import (
  3. "testing"
  4. "github.com/dotcloud/docker/runconfig"
  5. "github.com/dotcloud/docker/utils"
  6. )
  7. func TestMergeLxcConfig(t *testing.T) {
  8. var (
  9. hostConfig = &runconfig.HostConfig{
  10. LxcConf: []utils.KeyValuePair{
  11. {Key: "lxc.cgroups.cpuset", Value: "1,2"},
  12. },
  13. }
  14. driverConfig = make(map[string][]string)
  15. )
  16. mergeLxcConfIntoOptions(hostConfig, driverConfig)
  17. if l := len(driverConfig["lxc"]); l > 1 {
  18. t.Fatalf("expected lxc options len of 1 got %d", l)
  19. }
  20. cpuset := driverConfig["lxc"][0]
  21. if expected := "cgroups.cpuset=1,2"; cpuset != expected {
  22. t.Fatalf("expected %s got %s", expected, cpuset)
  23. }
  24. }