Skip to content

Commit

Permalink
chore: update mongo driver (zeromicro#3727)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan authored Nov 19, 2023
1 parent 9c1aa6d commit 2f8cffc
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 112 deletions.
2 changes: 0 additions & 2 deletions core/stores/mon/bulkinserter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (

func TestBulkInserter(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
mt.AddMockResponses(mtest.CreateSuccessResponse(bson.D{{Key: "ok", Value: 1}}...))
bulk, err := NewBulkInserter(createModel(mt).Collection)
Expand Down
2 changes: 0 additions & 2 deletions core/stores/mon/clientmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (

func TestClientManger_getClient(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
Inject(mtest.ClusterURI(), mt.Client)
cli, err := getClient(mtest.ClusterURI())
Expand Down
39 changes: 0 additions & 39 deletions core/stores/mon/collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func TestKeepPromise_keep(t *testing.T) {

func TestNewCollection(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()
mt.Run("test", func(mt *mtest.T) {
coll := mt.Coll
assert.NotNil(t, coll)
Expand All @@ -79,7 +78,6 @@ func TestNewCollection(t *testing.T) {

func TestCollection_Aggregate(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()
mt.Run("test", func(mt *mtest.T) {
coll := mt.Coll
assert.NotNil(t, coll)
Expand All @@ -96,8 +94,6 @@ func TestCollection_Aggregate(t *testing.T) {

func TestCollection_BulkWrite(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -119,8 +115,6 @@ func TestCollection_BulkWrite(t *testing.T) {

func TestCollection_CountDocuments(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -145,8 +139,6 @@ func TestCollection_CountDocuments(t *testing.T) {

func TestDecoratedCollection_DeleteMany(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -165,8 +157,6 @@ func TestDecoratedCollection_DeleteMany(t *testing.T) {

func TestCollection_Distinct(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -185,8 +175,6 @@ func TestCollection_Distinct(t *testing.T) {

func TestCollection_EstimatedDocumentCount(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -205,8 +193,6 @@ func TestCollection_EstimatedDocumentCount(t *testing.T) {

func TestCollection_Find(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand Down Expand Up @@ -253,8 +239,6 @@ func TestCollection_Find(t *testing.T) {

func TestCollection_FindOne(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand Down Expand Up @@ -297,8 +281,6 @@ func TestCollection_FindOne(t *testing.T) {

func TestCollection_FindOneAndDelete(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand Down Expand Up @@ -328,8 +310,6 @@ func TestCollection_FindOneAndDelete(t *testing.T) {

func TestCollection_FindOneAndReplace(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand Down Expand Up @@ -360,8 +340,6 @@ func TestCollection_FindOneAndReplace(t *testing.T) {

func TestCollection_FindOneAndUpdate(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand Down Expand Up @@ -393,8 +371,6 @@ func TestCollection_FindOneAndUpdate(t *testing.T) {

func TestCollection_InsertOne(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -413,8 +389,6 @@ func TestCollection_InsertOne(t *testing.T) {

func TestCollection_InsertMany(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -437,8 +411,6 @@ func TestCollection_InsertMany(t *testing.T) {

func TestCollection_DeleteOne(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -457,8 +429,6 @@ func TestCollection_DeleteOne(t *testing.T) {

func TestCollection_DeleteMany(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -477,8 +447,6 @@ func TestCollection_DeleteMany(t *testing.T) {

func TestCollection_ReplaceOne(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -500,8 +468,6 @@ func TestCollection_ReplaceOne(t *testing.T) {

func TestCollection_UpdateOne(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -522,8 +488,6 @@ func TestCollection_UpdateOne(t *testing.T) {

func TestCollection_UpdateByID(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -544,8 +508,6 @@ func TestCollection_UpdateByID(t *testing.T) {

func TestCollection_UpdateMany(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
c := decoratedCollection{
Collection: mt.Coll,
Expand All @@ -566,7 +528,6 @@ func TestCollection_UpdateMany(t *testing.T) {

func TestDecoratedCollection_LogDuration(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()
c := decoratedCollection{
Collection: mt.Coll,
brk: breaker.NewBreaker(),
Expand Down
18 changes: 0 additions & 18 deletions core/stores/mon/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (

func TestModel_StartSession(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
sess, err := m.StartSession()
Expand All @@ -34,8 +32,6 @@ func TestModel_StartSession(t *testing.T) {

func TestModel_Aggregate(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
find := mtest.CreateCursorResponse(
Expand Down Expand Up @@ -71,8 +67,6 @@ func TestModel_Aggregate(t *testing.T) {

func TestModel_DeleteMany(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
mt.AddMockResponses(mtest.CreateSuccessResponse(bson.D{{Key: "n", Value: 1}}...))
Expand All @@ -88,8 +82,6 @@ func TestModel_DeleteMany(t *testing.T) {

func TestModel_DeleteOne(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
mt.AddMockResponses(mtest.CreateSuccessResponse(bson.D{{Key: "n", Value: 1}}...))
Expand All @@ -105,8 +97,6 @@ func TestModel_DeleteOne(t *testing.T) {

func TestModel_Find(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
find := mtest.CreateCursorResponse(
Expand Down Expand Up @@ -142,8 +132,6 @@ func TestModel_Find(t *testing.T) {

func TestModel_FindOne(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
find := mtest.CreateCursorResponse(
Expand All @@ -170,8 +158,6 @@ func TestModel_FindOne(t *testing.T) {

func TestModel_FindOneAndDelete(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
mt.AddMockResponses(mtest.CreateSuccessResponse(bson.D{
Expand All @@ -189,8 +175,6 @@ func TestModel_FindOneAndDelete(t *testing.T) {

func TestModel_FindOneAndReplace(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
mt.AddMockResponses(mtest.CreateSuccessResponse(bson.D{
Expand All @@ -212,8 +196,6 @@ func TestModel_FindOneAndReplace(t *testing.T) {

func TestModel_FindOneAndUpdate(t *testing.T) {
mt := mtest.New(t, mtest.NewOptions().ClientType(mtest.Mock))
defer mt.Close()

mt.Run("test", func(mt *mtest.T) {
m := createModel(mt)
mt.AddMockResponses(mtest.CreateSuccessResponse(bson.D{
Expand Down
Loading

0 comments on commit 2f8cffc

Please sign in to comment.