Skip to content
Snippets Groups Projects
Commit 830f413c authored by Andre Sterba's avatar Andre Sterba Committed by Fabian Seidl
Browse files

Update mongo driver and fix deprecations

See merge request !495
parent 8df76ce0
Branches
Tags
1 merge request!495Update mongo driver and fix deprecations
Pipeline #159124 failed
...@@ -14,6 +14,13 @@ BUILD_ARTIFACTS_PATH=artifacts ...@@ -14,6 +14,13 @@ BUILD_ARTIFACTS_PATH=artifacts
PLUGIN_NAME= bundled_plugin.zip PLUGIN_NAME= bundled_plugin.zip
# Tool Versions
GOTESTSUM_VERSION=v1.8.1
GOLANGCI_LINT_VERSION=v1.53.3
MOCKERY_VERSION=v2.20.0
YGOT_GENERATOR_VERSION=v0.27.0
YGOT_GENERATOR_GENERATOR_VERSION=v0.0.4
all: build all: build
pre: pre:
...@@ -28,11 +35,11 @@ create-clab-dir: create-gosdn-tmp-dir ...@@ -28,11 +35,11 @@ create-clab-dir: create-gosdn-tmp-dir
install-tools: install-tools:
@echo Install development tooling @echo Install development tooling
mkdir -p $(GOSDN_PRG) mkdir -p $(GOSDN_PRG)
export GOBIN=$(GOSDN_PRG) && go install gotest.tools/gotestsum@v1.8.1 &&\ export GOBIN=$(GOSDN_PRG) && go install gotest.tools/gotestsum@$(GOTESTSUM_VERSION) &&\
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 &&\ go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) &&\
go install github.com/vektra/mockery/v2@v2.20.0 &&\ go install github.com/vektra/mockery/v2@$(MOCKERY_VERSION) &&\
go install github.com/openconfig/ygot/generator@v0.27.0 &&\ go install github.com/openconfig/ygot/generator@$(YGOT_GENERATOR_VERSION) &&\
go install github.com/andresterba/go-ygot-generator-generator@v0.0.4 go install github.com/andresterba/go-ygot-generator-generator@$(YGOT_GENERATOR_GENERATOR_VERSION)
@echo Finished installing development tooling @echo Finished installing development tooling
ci-install-tools: ci-install-tools:
......
...@@ -20,16 +20,11 @@ const ( ...@@ -20,16 +20,11 @@ const (
// GetMongoConnection Retrieves a client to the MongoDB. // GetMongoConnection Retrieves a client to the MongoDB.
func GetMongoConnection() (*mongo.Client, context.Context, context.CancelFunc) { func GetMongoConnection() (*mongo.Client, context.Context, context.CancelFunc) {
mongoConnection := config.DatabaseConnection mongoConnection := config.DatabaseConnection
client, err := mongo.NewClient(options.Client().ApplyURI(mongoConnection))
if err != nil {
log.Printf("Failed to create client: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), connectTimeout*time.Second) ctx, cancel := context.WithTimeout(context.Background(), connectTimeout*time.Second)
err = client.Connect(ctx) client, err := mongo.Connect(ctx, options.Client().ApplyURI(mongoConnection))
if err != nil { if err != nil {
log.Printf("Failed to connect to cluster: %v", err) log.Printf("Failed to create client: %v", err)
} }
// Force a connection to verify our connection string // Force a connection to verify our connection string
......
...@@ -171,7 +171,8 @@ func (s *DatabaseNetworkElementStore) Update(networkElementToUpdate networkeleme ...@@ -171,7 +171,8 @@ func (s *DatabaseNetworkElementStore) Update(networkElementToUpdate networkeleme
}() }()
// 1. Start Transaction // 1. Start Transaction
wcMajority := writeconcern.New(writeconcern.WMajority()) wcMajority := writeconcern.Majority()
wcMajorityCollectionOpts := options.Collection().SetWriteConcern(wcMajority) wcMajorityCollectionOpts := options.Collection().SetWriteConcern(wcMajority)
userCollection := client.Database(database.DatabaseName).Collection(s.storeName, wcMajorityCollectionOpts) userCollection := client.Database(database.DatabaseName).Collection(s.storeName, wcMajorityCollectionOpts)
......
...@@ -189,7 +189,7 @@ func (s *DatabaseUserStore) Update(userToUpdate rbac.User) (err error) { ...@@ -189,7 +189,7 @@ func (s *DatabaseUserStore) Update(userToUpdate rbac.User) (err error) {
}() }()
// 1. Start Transaction // 1. Start Transaction
wcMajority := writeconcern.New(writeconcern.WMajority()) wcMajority := writeconcern.Majority()
wcMajorityCollectionOpts := options.Collection().SetWriteConcern(wcMajority) wcMajorityCollectionOpts := options.Collection().SetWriteConcern(wcMajority)
userCollection := client.Database(database.DatabaseName).Collection(s.userStoreName, wcMajorityCollectionOpts) userCollection := client.Database(database.DatabaseName).Collection(s.userStoreName, wcMajorityCollectionOpts)
......
...@@ -181,7 +181,7 @@ func (s *DatabaseNodeStore) Update(node Node) (err error) { ...@@ -181,7 +181,7 @@ func (s *DatabaseNodeStore) Update(node Node) (err error) {
}() }()
// 1. Start Transaction // 1. Start Transaction
wcMajority := writeconcern.New(writeconcern.WMajority()) wcMajority := writeconcern.Majority()
wcMajorityCollectionOpts := options.Collection().SetWriteConcern(wcMajority) wcMajorityCollectionOpts := options.Collection().SetWriteConcern(wcMajority)
nodeCollection := client.Database(database.DatabaseName).Collection(s.storeName, wcMajorityCollectionOpts) nodeCollection := client.Database(database.DatabaseName).Collection(s.storeName, wcMajorityCollectionOpts)
......
...@@ -22,7 +22,7 @@ require ( ...@@ -22,7 +22,7 @@ require (
github.com/spf13/viper v1.15.0 github.com/spf13/viper v1.15.0
github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/testify v1.8.1 github.com/stretchr/testify v1.8.1
go.mongodb.org/mongo-driver v1.10.0 go.mongodb.org/mongo-driver v1.12.0
golang.org/x/sync v0.1.0 golang.org/x/sync v0.1.0
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 google.golang.org/genproto v0.0.0-20230223222841-637eb2293923
google.golang.org/grpc v1.53.0 google.golang.org/grpc v1.53.0
...@@ -81,8 +81,8 @@ require ( ...@@ -81,8 +81,8 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect github.com/subosito/gotenv v1.4.2 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.1 // indirect github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.3 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
go.opencensus.io v0.24.0 // indirect go.opencensus.io v0.24.0 // indirect
......
...@@ -985,8 +985,12 @@ github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= ...@@ -985,8 +985,12 @@ github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E= github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs= github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
...@@ -1021,6 +1025,8 @@ go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD0 ...@@ -1021,6 +1025,8 @@ go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD0
go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4=
go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg= go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg=
go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8=
go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
...@@ -1341,6 +1347,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= ...@@ -1341,6 +1347,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment