Skip to content

Commit

Permalink
use time.Unix const
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpionknifes committed Sep 19, 2024
1 parent d3b2bdd commit 52d467a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions bridges/otellogr/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ func TestConvertKVs(t *testing.T) {
}

func TestConvertValue(t *testing.T) {
now := time.Now()

for _, tt := range []struct {
name string
value any
Expand Down Expand Up @@ -179,8 +177,8 @@ func TestConvertValue(t *testing.T) {
},
{
name: "time.Time",
value: now,
wantValue: log.Int64Value(now.UnixNano()),
value: time.Unix(1000, 1000),
wantValue: log.Int64Value(time.Unix(1000, 1000).UnixNano()),
},
{
name: "[]byte",
Expand Down
5 changes: 2 additions & 3 deletions bridges/otellogr/logsink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func TestNewLogSink(t *testing.T) {

func TestLogSink(t *testing.T) {
const name = "name"
now := time.Now()

for _, tt := range []struct {
name string
Expand Down Expand Up @@ -149,7 +148,7 @@ func TestLogSink(t *testing.T) {
"float64", 3.14159,
"int64", -2,
"string", "str",
"time", now,
"time", time.Unix(1000, 1000),
"uint64", uint64(3),
)
},
Expand All @@ -162,7 +161,7 @@ func TestLogSink(t *testing.T) {
log.Float64("float64", 3.14159),
log.Int64("int64", -2),
log.String("string", "str"),
log.Int64("time", now.UnixNano()),
log.Int64("time", time.Unix(1000, 1000).UnixNano()),
log.Int64("uint64", 3),
}),
},
Expand Down

0 comments on commit 52d467a

Please sign in to comment.