feat: add trace in redis & mon & sql (#1799)
* feat: add sub spanId with redis Signed-off-by: chenquan <chenquan.dev@gmail.com> * add tests Signed-off-by: chenquan <chenquan.dev@gmail.com> * fix a bug Signed-off-by: chenquan <chenquan.dev@gmail.com> * feat: add sub spanId in sql Signed-off-by: chenquan <chenquan.dev@gmail.com> * feat: add sub spanId in mon Signed-off-by: chenquan <chenquan.dev@gmail.com> * chore: optimize code Signed-off-by: chenquan <chenquan.dev@gmail.com> * feat: add breaker in warpSession Signed-off-by: chenquan <chenquan.dev@gmail.com> * chore: optimize code Signed-off-by: chenquan <chenquan.dev@gmail.com> * test: add tests Signed-off-by: chenquan <chenquan.dev@gmail.com> * chore: reformat code Signed-off-by: chenquan <chenquan.dev@gmail.com> * fix: fix typo Signed-off-by: chenquan <chenquan.dev@gmail.com> * fix a bug Signed-off-by: chenquan <chenquan.dev@gmail.com>
This commit is contained in:
@@ -18,6 +18,17 @@ func TestModel_StartSession(t *testing.T) {
|
||||
m := createModel(mt)
|
||||
sess, err := m.StartSession()
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, err = sess.WithTransaction(context.Background(), func(sessCtx mongo.SessionContext) (interface{}, error) {
|
||||
_ = sessCtx.StartTransaction()
|
||||
sessCtx.Client().Database("1")
|
||||
sessCtx.EndSession(context.Background())
|
||||
return nil, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.NoError(t, sess.CommitTransaction(context.Background()))
|
||||
assert.Error(t, sess.AbortTransaction(context.Background()))
|
||||
sess.EndSession(context.Background())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user