Skip to content

Commit

Permalink
Merge branch 'development' of github.com:gofr-dev/gofr into test/pipe…
Browse files Browse the repository at this point in the history
…line
  • Loading branch information
Umang01-hash committed Jan 24, 2025
2 parents f2e404c + b5547c7 commit e2ee9fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/gofr/datasource/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,12 @@ func (c *Client) Connect() {
return
}

c.logger.Logf("connected to MongoDB successfully at %v to database %v", host, c.config.Database)

mongoBuckets := []float64{.05, .075, .1, .125, .15, .2, .3, .5, .75, 1, 2, 3, 4, 5, 7.5, 10}
c.metrics.NewHistogram("app_mongo_stats", "Response time of MongoDB queries in milliseconds.", mongoBuckets...)

c.Database = m.Database(c.config.Database)

c.logger.Logf("connected to MongoDB at %v to database %v", host, c.Database)
c.logger.Logf("connected to MongoDB at %v to database %v", host, c.config.Database)
}

func generateMongoURI(config *Config) (uri, host string, err error) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/gofr/datasource/mongo/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ func Test_NewMongoClient(t *testing.T) {
logger := NewMockLogger(ctrl)

logger.EXPECT().Debugf(gomock.Any(), gomock.Any())
logger.EXPECT().Logf(gomock.Any(), gomock.Any(), gomock.Any())

logger.EXPECT().Errorf(gomock.Any(), gomock.Any(), gomock.Any())
metrics.EXPECT().NewHistogram(gomock.Any(), gomock.Any(), gomock.Any())

client := New(Config{Database: "test", Host: "localhost", Port: 27017, User: "admin", ConnectionTimeout: 1 * time.Second})
client.Database = &mongo.Database{}
Expand Down

0 comments on commit e2ee9fc

Please sign in to comment.