refactor: refactor trace in redis & sql & mongo (#1865)
* refactor: refactor tracing in redis & sql & mongo Signed-off-by: chenquan <chenquan.dev@gmail.com> * fix: fix some tests Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: add missing content Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: adjust `log` and `return` Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: reformat code Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: reformat code Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: reformat code Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: simpler span name Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: fix a bug Signed-off-by: chenquan <chenquan.dev@gmail.com> * refactor: fix a bug Signed-off-by: chenquan <chenquan.dev@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ func TestHookProcessCase1(t *testing.T) {
|
||||
log.SetOutput(&buf)
|
||||
defer log.SetOutput(writer)
|
||||
|
||||
ctx, err := durationHook.BeforeProcess(context.Background(), nil)
|
||||
ctx, err := durationHook.BeforeProcess(context.Background(), red.NewCmd(context.Background()))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -48,7 +48,7 @@ func TestHookProcessCase2(t *testing.T) {
|
||||
w, restore := injectLog()
|
||||
defer restore()
|
||||
|
||||
ctx, err := durationHook.BeforeProcess(context.Background(), nil)
|
||||
ctx, err := durationHook.BeforeProcess(context.Background(), red.NewCmd(context.Background()))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -89,7 +89,7 @@ func TestHookProcessPipelineCase1(t *testing.T) {
|
||||
log.SetOutput(&buf)
|
||||
defer log.SetOutput(writer)
|
||||
|
||||
ctx, err := durationHook.BeforeProcessPipeline(context.Background(), nil)
|
||||
ctx, err := durationHook.BeforeProcessPipeline(context.Background(), []red.Cmder{red.NewCmd(context.Background())})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func TestHookProcessPipelineCase2(t *testing.T) {
|
||||
w, restore := injectLog()
|
||||
defer restore()
|
||||
|
||||
ctx, err := durationHook.BeforeProcessPipeline(context.Background(), nil)
|
||||
ctx, err := durationHook.BeforeProcessPipeline(context.Background(), []red.Cmder{red.NewCmd(context.Background())})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func TestHookProcessPipelineCase5(t *testing.T) {
|
||||
defer log.SetOutput(writer)
|
||||
|
||||
ctx := context.WithValue(context.Background(), startTimeKey, "foo")
|
||||
assert.Nil(t, durationHook.AfterProcessPipeline(ctx, nil))
|
||||
assert.Nil(t, durationHook.AfterProcessPipeline(ctx, []red.Cmder{red.NewCmd(context.Background())}))
|
||||
assert.True(t, buf.Len() == 0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user