mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
72f1881df1
- Stop serializing JSONMessage in favor of events.Message. - Keep backwards compatibility with JSONMessage for container events. Signed-off-by: David Calavera <david.calavera@gmail.com>
36 lines
806 B
Go
36 lines
806 B
Go
package daemon
|
|
|
|
import (
|
|
"testing"
|
|
|
|
containertypes "github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/container"
|
|
"github.com/docker/docker/daemon/events"
|
|
)
|
|
|
|
func TestLogContainerCopyLabels(t *testing.T) {
|
|
e := events.New()
|
|
_, l, _ := e.Subscribe()
|
|
defer e.Evict(l)
|
|
|
|
container := &container.Container{
|
|
CommonContainer: container.CommonContainer{
|
|
ID: "container_id",
|
|
Name: "container_name",
|
|
Config: &containertypes.Config{
|
|
Labels: map[string]string{
|
|
"node": "1",
|
|
"os": "alpine",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
daemon := &Daemon{
|
|
EventsService: e,
|
|
}
|
|
daemon.LogContainerEvent(container, "create")
|
|
|
|
if _, mutated := container.Config.Labels["image"]; mutated {
|
|
t.Fatalf("Expected to not mutate the container labels, got %q", container.Config.Labels)
|
|
}
|
|
}
|