Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: common/eventlog/eventlog_test.go

Issue 2517503002: luci-go: Basic support for event logging in Go. (Closed)
Patch Set: Add helpers for generating TypedTime Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/eventlog/eventlog.go ('k') | common/eventlog/internal/logservice/logservice.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package eventlog
6
7 import (
8 "context"
9 "reflect"
10 "testing"
11 "time"
12
13 "github.com/golang/protobuf/proto"
14 logpb "github.com/luci/luci-go/common/eventlog/proto"
15 )
16
17 func TestGeneratesLogEvent(t *testing.T) {
18 c := Client{EventSource: &logpb.InfraEventSource{}}
19
20 var tNano int64 = 1e9
21 begin := logpb.ChromeInfraEvent_BEGIN
22 et := TypedTime{
23 time.Unix(0, tNano),
24 begin,
25 }
26 want := &ChromeInfraLogEvent{
27 LogEvent: &logpb.LogRequestLite_LogEventLite{
28 EventTimeMs: proto.Int64(tNano / 1e6),
29 },
30 InfraEvent: &logpb.ChromeInfraEvent{
31 TimestampKind: &begin,
32 EventSource: c.EventSource,
33 },
34 }
35
36 got := c.NewLogEvent(context.Background(), et)
37
38 if !reflect.DeepEqual(got, want) {
39 t.Errorf("generated log event: got: %v; want: %v", got, want)
40 }
41 }
OLDNEW
« no previous file with comments | « common/eventlog/eventlog.go ('k') | common/eventlog/internal/logservice/logservice.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698