Skip to content

Commit

Permalink
feat: Use new resource info struct
Browse files Browse the repository at this point in the history
  • Loading branch information
hofmeister committed Apr 16, 2024
1 parent 26d9934 commit 30a2eaf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/kapetacom/sdk-go-nosql-mongodb
go 1.21.7

require (
github.com/kapetacom/sdk-go-config v0.1.3
github.com/kapetacom/sdk-go-config v1.0.0
github.com/stretchr/testify v1.8.4
go.mongodb.org/mongo-driver v1.13.1
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/kapetacom/schemas/packages/go v0.0.0-20240209083259-f5ce079d8abc h1:ghhXNScFqGXUP7uywvPF/dyYBcS7czmirlLcgtc0cEg=
github.com/kapetacom/schemas/packages/go v0.0.0-20240209083259-f5ce079d8abc/go.mod h1:dWvKSUqSQRHiqFFnGPnJofgci1dvRT1PPNJLtffVukk=
github.com/kapetacom/sdk-go-config v0.1.3 h1:Vv6j72Dag7XIF+FfHQVifNnxB7Lv/l+APfYoZO4rj0M=
github.com/kapetacom/sdk-go-config v0.1.3/go.mod h1:8JfwwJJc9qAACr/BPXo7lF9OZE8PL/HNeBnRqRTdMhU=
github.com/kapetacom/sdk-go-config v1.0.0 h1:2Kjn1CBdeTH3sJfUHvEyaXODyLuKv1WwK8xRnoyZAbA=
github.com/kapetacom/sdk-go-config v1.0.0/go.mod h1:ayxOGlxQ4Cz1OQi3JnaleDd7H0lknyl9xr9bSUIeHlM=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.17.6 h1:60eq2E/jlfwQXtvZEeBUYADs+BwKBWURIY+Gj2eRGjI=
github.com/klauspost/compress v1.17.6/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
Expand Down
13 changes: 7 additions & 6 deletions mongo_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mongo

import (
"encoding/json"
"testing"

"github.com/kapetacom/sdk-go-config/providers"
Expand Down Expand Up @@ -43,7 +44,7 @@ func TestCreateConnectionStringProtocolMongodb(t *testing.T) {
t.Run("create connection string with mongodb protocol", func(t *testing.T) {
resInfo := &providers.ResourceInfo{
Host: "localhost",
Port: "27017",
Port: json.Number("27017"),
Credentials: map[string]string{"username": "user", "password": "password"},
}
dbName := "test"
Expand All @@ -57,7 +58,7 @@ func TestCreateConnectionStringProtocolMongodb(t *testing.T) {
t.Run("verify that the mongodb+srv connection string doesn't have a port and a direct connection", func(t *testing.T) {
resInfo := &providers.ResourceInfo{
Host: "localhost",
Port: "27017",
Port: json.Number("27017"),
Options: map[string]interface{}{"protocol": "mongodb+srv"},
Credentials: map[string]string{"username": "user", "password": "password"},
}
Expand All @@ -72,7 +73,7 @@ func TestCreateConnectionStringProtocolMongodb(t *testing.T) {
t.Run("verify that mongodb connection string contains directConnection", func(t *testing.T) {
resInfo := &providers.ResourceInfo{
Host: "localhost",
Port: "27017",
Port: json.Number("27017"),
Credentials: map[string]string{"username": "user", "password": "password"},
}
dbName := "test"
Expand All @@ -86,7 +87,7 @@ func TestCreateConnectionStringProtocolMongodb(t *testing.T) {
t.Run("verify that mongodb connection string contains ssl true", func(t *testing.T) {
resInfo := &providers.ResourceInfo{
Host: "localhost",
Port: "27017",
Port: json.Number("27017"),
Credentials: map[string]string{"username": "user", "password": "password"},
Options: map[string]interface{}{"ssl": "true"},
}
Expand All @@ -101,7 +102,7 @@ func TestCreateConnectionStringProtocolMongodb(t *testing.T) {
t.Run("verify that mongodb connection string contains ssl false", func(t *testing.T) {
resInfo := &providers.ResourceInfo{
Host: "localhost",
Port: "27017",
Port: json.Number("27017"),
Credentials: map[string]string{"username": "user", "password": "password"},
Options: map[string]interface{}{"ssl": "false"},
}
Expand All @@ -118,7 +119,7 @@ func TestCreateConnectionString(t *testing.T) {
t.Run("create connection string", func(t *testing.T) {
resInfo := &providers.ResourceInfo{
Host: "localhost",
Port: "27017",
Port: json.Number("27017"),
Credentials: map[string]string{"username": "user", "password": "password"},
}
resourceName := "test"
Expand Down

0 comments on commit 30a2eaf

Please sign in to comment.