summaryrefslogtreecommitdiff
path: root/runtime/utils_test.go
blob: bdf3543a497350bfced8a96d72ea8988b57ecaf6 (plain)
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
package runtime

import (
	"testing"

	"github.com/dotcloud/docker/runconfig"
	"github.com/dotcloud/docker/utils"
)

func TestMergeLxcConfig(t *testing.T) {
	var (
		hostConfig = &runconfig.HostConfig{
			LxcConf: []utils.KeyValuePair{
				{Key: "lxc.cgroups.cpuset", Value: "1,2"},
			},
		}
		driverConfig = make(map[string][]string)
	)

	mergeLxcConfIntoOptions(hostConfig, driverConfig)
	if l := len(driverConfig["lxc"]); l > 1 {
		t.Fatalf("expected lxc options len of 1 got %d", l)
	}

	cpuset := driverConfig["lxc"][0]
	if expected := "cgroups.cpuset=1,2"; cpuset != expected {
		t.Fatalf("expected %s got %s", expected, cpuset)
	}
}