github.com/kunnos/engine@v1.13.1/daemon/logger/logger_test.go (about)

     1  package logger
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  	"time"
     7  )
     8  
     9  func TestCopyMessage(t *testing.T) {
    10  	msg := &Message{
    11  		Line:      []byte("test line."),
    12  		Source:    "stdout",
    13  		Timestamp: time.Now(),
    14  		Attrs: LogAttributes{
    15  			"key1": "val1",
    16  			"key2": "val2",
    17  			"key3": "val3",
    18  		},
    19  		Partial: true,
    20  	}
    21  
    22  	m := CopyMessage(msg)
    23  	if !reflect.DeepEqual(m, msg) {
    24  		t.Fatalf("CopyMessage failed to copy message")
    25  	}
    26  }