moby/daemon/logger/logger_test.go
Yanqiang Miao bf711ea00e Fix a error of the function 'CopyMessage' in 'daemon/logger/logger.go'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

add a test for 'CopyMessage'

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
(cherry picked from commit 3b82eac65f)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2016-11-30 14:08:05 -08:00

26 lines
413 B
Go

package logger
import (
"reflect"
"testing"
"time"
)
func TestCopyMessage(t *testing.T) {
msg := &Message{
Line: []byte("test line."),
Source: "stdout",
Timestamp: time.Now(),
Attrs: LogAttributes{
"key1": "val1",
"key2": "val2",
"key3": "val3",
},
Partial: true,
}
m := CopyMessage(msg)
if !reflect.DeepEqual(m, msg) {
t.Fatalf("CopyMessage failed to copy message")
}
}