Skip to content

Commit

Permalink
test(connection): fix existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danvergara committed Oct 21, 2022
1 parent 11f47a5 commit bd5f26d
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions pkg/connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestBuildConnectionFromOptsFromURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@tcp(localhost:3306)/db",
uri: "user:password@tcp(localhost:3306)/db",
},
},
{
Expand All @@ -88,7 +88,7 @@ func TestBuildConnectionFromOptsFromURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@tcp(localhost:3306)/db?charset=utf8",
uri: "user:password@tcp(localhost:3306)/db?charset=utf8",
},
},
{
Expand All @@ -99,7 +99,7 @@ func TestBuildConnectionFromOptsFromURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@tcp(your-amazonaws-uri.com:3306)/dbname",
uri: "user:password@tcp(your-amazonaws-uri.com:3306)/dbname",
},
},
{
Expand Down Expand Up @@ -456,7 +456,7 @@ func TestFormatMySQLURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@tcp(localhost:3306)/db",
uri: "user:password@tcp(localhost:3306)/db",
},
},
{
Expand All @@ -467,7 +467,7 @@ func TestFormatMySQLURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@tcp(localhost:3306)/db?charset=utf8",
uri: "user:password@tcp(localhost:3306)/db?charset=utf8",
},
},
{
Expand All @@ -478,7 +478,7 @@ func TestFormatMySQLURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@tcp(your-amazonaws-uri.com:3306)/dbname",
uri: "user:password@tcp(your-amazonaws-uri.com:3306)/dbname",
},
},
{
Expand All @@ -489,7 +489,7 @@ func TestFormatMySQLURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@/dbname?sql_mode=TRADITIONAL",
uri: "user:password@/dbname?sql_mode=TRADITIONAL",
},
},
{
Expand All @@ -500,7 +500,7 @@ func TestFormatMySQLURL(t *testing.T) {
},
},
want: want{
uri: "mysql://user:password@unix(/cloudsql/project-id:region-name:instance-name)/dbname",
uri: "user:password@unix(/cloudsql/project-id:region-name:instance-name)/dbname",
},
},
{
Expand All @@ -527,6 +527,17 @@ func TestFormatMySQLURL(t *testing.T) {
err: ErrInvalidMySQLURLFormat,
},
},
{
name: "valid with strange characters",
given: given{
opts: command.Options{
URL: "mysql://myuser:5@klkbN#ABC@@tcp(localhost:3306)/mydb",
},
},
want: want{
uri: "myuser:5@klkbN#ABC@@tcp(localhost:3306)/mydb",
},
},
}

for _, tc := range cases {
Expand Down

0 comments on commit bd5f26d

Please sign in to comment.