-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved cockroach configuration and fixed bugs on connection details (…
…#271) * improved cockroach configuration and fixed bugs on connection details * oops! didn't remove debugging log * bugfix: blank argument also affect as argument, in secure mode
- Loading branch information
1 parent
a67e8e0
commit 77ad6b2
Showing
6 changed files
with
205 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package pop | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_Cockroach_URL_Raw(t *testing.T) { | ||
r := require.New(t) | ||
|
||
cd := &ConnectionDetails{ | ||
Dialect: "cockroach", | ||
URL: "scheme://user:pass@host:port/database?option1=value1", | ||
} | ||
err := cd.Finalize() | ||
r.NoError(err) | ||
|
||
m := &cockroach{ConnectionDetails: cd} | ||
r.Equal("scheme://user:pass@host:port/database?option1=value1", m.URL()) | ||
r.Equal("postgres://user:pass@host:port/?option1=value1", m.urlWithoutDb()) | ||
} | ||
|
||
func Test_Cockroach_URL_Build(t *testing.T) { | ||
r := require.New(t) | ||
|
||
cd := &ConnectionDetails{ | ||
Dialect: "cockroach", | ||
Database: "database", | ||
Host: "host", | ||
Port: "port", | ||
User: "user", | ||
Password: "pass", | ||
Options: map[string]string{ | ||
"option1": "value1", | ||
}, | ||
} | ||
err := cd.Finalize() | ||
r.NoError(err) | ||
|
||
m := &cockroach{ConnectionDetails: cd} | ||
r.Equal("postgres://user:pass@host:port/database?application_name=cockroach&option1=value1", m.URL()) | ||
r.Equal("postgres://user:pass@host:port/?application_name=cockroach&option1=value1", m.urlWithoutDb()) | ||
} |