utils_test.go 538 B

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