Codebase list golang-github-go-kit-kit / 22fe74f
Run more tests in parallel. Chris Hines 7 years ago
6 changed file(s) with 9 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
9999 }
100100
101101 func TestJSONLoggerStringValue(t *testing.T) {
102 t.Parallel()
102103 tests := []struct {
103104 v interface{}
104105 expected string
7070 // whether Context.Log is called via an interface typed variable or a concrete
7171 // typed variable.
7272 func TestContextStackDepth(t *testing.T) {
73 t.Parallel()
7374 fn := fmt.Sprintf("%n", stack.Caller(0))
7475
7576 var output []interface{}
1010 )
1111
1212 func TestLogfmtLogger(t *testing.T) {
13 t.Parallel()
1314 buf := &bytes.Buffer{}
1415 logger := log.NewLogfmtLogger(buf)
1516
66 )
77
88 func TestNopLogger(t *testing.T) {
9 t.Parallel()
910 logger := log.NewNopLogger()
1011 if err := logger.Log("abc", 123); err != nil {
1112 t.Error(err)
88 )
99
1010 func TestSwapLogger(t *testing.T) {
11 t.Parallel()
1112 var logger log.SwapLogger
1213
1314 // Zero value does not panic or error.
88 )
99
1010 func TestValueBinding(t *testing.T) {
11 t.Parallel()
1112 var output []interface{}
1213
1314 logger := log.Logger(log.LoggerFunc(func(keyvals ...interface{}) error {
3233 if want, have := start.Add(time.Second), timestamp; want != have {
3334 t.Errorf("output[1]: want %v, have %v", want, have)
3435 }
35 if want, have := "value_test.go:28", fmt.Sprint(output[3]); want != have {
36 if want, have := "value_test.go:29", fmt.Sprint(output[3]); want != have {
3637 t.Errorf("output[3]: want %s, have %s", want, have)
3738 }
3839
4546 if want, have := start.Add(2*time.Second), timestamp; want != have {
4647 t.Errorf("output[1]: want %v, have %v", want, have)
4748 }
48 if want, have := "value_test.go:41", fmt.Sprint(output[3]); want != have {
49 if want, have := "value_test.go:42", fmt.Sprint(output[3]); want != have {
4950 t.Errorf("output[3]: want %s, have %s", want, have)
5051 }
5152 }
5253
5354 func TestValueBinding_loggingZeroKeyvals(t *testing.T) {
55 t.Parallel()
5456 var output []interface{}
5557
5658 logger := log.Logger(log.LoggerFunc(func(keyvals ...interface{}) error {