diff --git a/bridges/otellogrus/hook_test.go b/bridges/otellogrus/hook_test.go index c53f925af60..9524b627a89 100644 --- a/bridges/otellogrus/hook_test.go +++ b/bridges/otellogrus/hook_test.go @@ -22,23 +22,23 @@ func TestHookLevels(t *testing.T) { name string options []Option - expectedLevels []logrus.Level + wantLevels []logrus.Level }{ { - name: "with the default levels", - expectedLevels: logrus.AllLevels, + name: "with the default levels", + wantLevels: logrus.AllLevels, }, { name: "with provided levels", options: []Option{ WithLevels([]logrus.Level{logrus.PanicLevel}), }, - expectedLevels: []logrus.Level{logrus.PanicLevel}, + wantLevels: []logrus.Level{logrus.PanicLevel}, }, } { t.Run(tt.name, func(t *testing.T) { levels := NewHook(tt.options...).Levels() - assert.Equal(t, tt.expectedLevels, levels) + assert.Equal(t, tt.wantLevels, levels) }) } } @@ -50,14 +50,14 @@ func TestHookFire(t *testing.T) { name string entry *logrus.Entry - expectedRecords map[string][]log.Record - expectedErr error + wantRecords map[string][]log.Record + wantErr error }{ { name: "emits an empty log entry", entry: &logrus.Entry{}, - expectedRecords: map[string][]log.Record{ + wantRecords: map[string][]log.Record{ bridgeName: []log.Record{ buildRecord(log.StringValue(""), time.Time{}, 0, nil), }, @@ -68,7 +68,7 @@ func TestHookFire(t *testing.T) { entry: &logrus.Entry{ Time: now, }, - expectedRecords: map[string][]log.Record{ + wantRecords: map[string][]log.Record{ bridgeName: []log.Record{ buildRecord(log.StringValue(""), now, 0, nil), }, @@ -79,7 +79,7 @@ func TestHookFire(t *testing.T) { entry: &logrus.Entry{ Level: logrus.FatalLevel, }, - expectedRecords: map[string][]log.Record{ + wantRecords: map[string][]log.Record{ bridgeName: []log.Record{ buildRecord(log.StringValue(""), time.Time{}, log.SeverityTrace1, nil), }, @@ -93,7 +93,7 @@ func TestHookFire(t *testing.T) { "answer": 42, }, }, - expectedRecords: map[string][]log.Record{ + wantRecords: map[string][]log.Record{ bridgeName: []log.Record{ buildRecord(log.StringValue(""), time.Time{}, 0, []log.KeyValue{ log.String("hello", "world"), @@ -107,9 +107,9 @@ func TestHookFire(t *testing.T) { rec := logtest.NewRecorder() err := NewHook(WithLoggerProvider(rec)).Fire(tt.entry) - assert.Equal(t, tt.expectedErr, err) + assert.Equal(t, tt.wantErr, err) - for k, v := range tt.expectedRecords { + for k, v := range tt.wantRecords { found := false for _, s := range rec.Result() { @@ -119,7 +119,7 @@ func TestHookFire(t *testing.T) { } } - assert.Truef(t, found, "expected to find records with a scope named %q", k) + assert.Truef(t, found, "want to find records with a scope named %q", k) } }) } @@ -129,14 +129,14 @@ func TestConvertFields(t *testing.T) { for _, tt := range []struct { name string - fields logrus.Fields - expectedKeyValue []log.KeyValue + fields logrus.Fields + wantKeyValue []log.KeyValue }{ { name: "with a boolean", fields: logrus.Fields{"hello": true}, - expectedKeyValue: []log.KeyValue{ + wantKeyValue: []log.KeyValue{ log.Bool("hello", true), }, }, @@ -144,7 +144,7 @@ func TestConvertFields(t *testing.T) { name: "with a bytes array", fields: logrus.Fields{"hello": []byte("world")}, - expectedKeyValue: []log.KeyValue{ + wantKeyValue: []log.KeyValue{ log.Bytes("hello", []byte("world")), }, }, @@ -152,7 +152,7 @@ func TestConvertFields(t *testing.T) { name: "with a float64", fields: logrus.Fields{"hello": 6.5}, - expectedKeyValue: []log.KeyValue{ + wantKeyValue: []log.KeyValue{ log.Float64("hello", 6.5), }, }, @@ -160,7 +160,7 @@ func TestConvertFields(t *testing.T) { name: "with an int", fields: logrus.Fields{"hello": 42}, - expectedKeyValue: []log.KeyValue{ + wantKeyValue: []log.KeyValue{ log.Int("hello", 42), }, }, @@ -168,7 +168,7 @@ func TestConvertFields(t *testing.T) { name: "with an int64", fields: logrus.Fields{"hello": int64(42)}, - expectedKeyValue: []log.KeyValue{ + wantKeyValue: []log.KeyValue{ log.Int64("hello", 42), }, }, @@ -176,13 +176,13 @@ func TestConvertFields(t *testing.T) { name: "with a string", fields: logrus.Fields{"hello": "world"}, - expectedKeyValue: []log.KeyValue{ + wantKeyValue: []log.KeyValue{ log.String("hello", "world"), }, }, } { t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, convertFields(tt.fields), tt.expectedKeyValue) + assert.Equal(t, convertFields(tt.fields), tt.wantKeyValue) }) } }