github.com/endocode/docker@v1.4.2-0.20160113120958-46eb4700391e/daemon/events_test.go (about) 1 package daemon 2 3 import ( 4 "testing" 5 6 "github.com/docker/docker/container" 7 "github.com/docker/docker/daemon/events" 8 containertypes "github.com/docker/engine-api/types/container" 9 ) 10 11 func TestLogContainerCopyLabels(t *testing.T) { 12 e := events.New() 13 _, l, _ := e.Subscribe() 14 defer e.Evict(l) 15 16 container := &container.Container{ 17 CommonContainer: container.CommonContainer{ 18 ID: "container_id", 19 Name: "container_name", 20 Config: &containertypes.Config{ 21 Labels: map[string]string{ 22 "node": "1", 23 "os": "alpine", 24 }, 25 }, 26 }, 27 } 28 daemon := &Daemon{ 29 EventsService: e, 30 } 31 daemon.LogContainerEvent(container, "create") 32 33 if _, mutated := container.Config.Labels["image"]; mutated { 34 t.Fatalf("Expected to not mutate the container labels, got %q", container.Config.Labels) 35 } 36 }