| Index: common/eventlog/eventlog_test.go
|
| diff --git a/common/eventlog/eventlog_test.go b/common/eventlog/eventlog_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a28a210cb78ef3e5f4778dd61166a3b8ee3e72f5
|
| --- /dev/null
|
| +++ b/common/eventlog/eventlog_test.go
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2016 The LUCI Authors. All rights reserved.
|
| +// Use of this source code is governed under the Apache License, Version 2.0
|
| +// that can be found in the LICENSE file.
|
| +
|
| +package eventlog
|
| +
|
| +import (
|
| + "context"
|
| + "reflect"
|
| + "testing"
|
| + "time"
|
| +
|
| + "github.com/golang/protobuf/proto"
|
| + logpb "github.com/luci/luci-go/common/eventlog/proto"
|
| +)
|
| +
|
| +func TestGeneratesLogEvent(t *testing.T) {
|
| + c := Client{EventSource: &logpb.InfraEventSource{}}
|
| +
|
| + var tNano int64 = 1e9
|
| + begin := logpb.ChromeInfraEvent_BEGIN
|
| + et := TypedTime{
|
| + time.Unix(0, tNano),
|
| + begin,
|
| + }
|
| + want := &ChromeInfraLogEvent{
|
| + LogEvent: &logpb.LogRequestLite_LogEventLite{
|
| + EventTimeMs: proto.Int64(tNano / 1e6),
|
| + },
|
| + InfraEvent: &logpb.ChromeInfraEvent{
|
| + TimestampKind: &begin,
|
| + EventSource: c.EventSource,
|
| + },
|
| + }
|
| +
|
| + got := c.NewLogEvent(context.Background(), et)
|
| +
|
| + if !reflect.DeepEqual(got, want) {
|
| + t.Errorf("generated log event: got: %v; want: %v", got, want)
|
| + }
|
| +}
|
|
|