-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta/pg:fix pg socket connection (#2607)
- Loading branch information
1 parent
42c66bc
commit bb84127
Showing
4 changed files
with
17 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,13 +41,14 @@ func Test_setPasswordFromEnv(t *testing.T) { | |
args: "mysql://root@(127.0.0.1:3306)/juicefs", | ||
want: "mysql://root:dbPasswd@(127.0.0.1:3306)/juicefs", | ||
}, | ||
// no user is ok | ||
{ | ||
args: "mysql://(127.0.0.1:3306)/juicefs", | ||
want: "", | ||
args: "mysql://:@(127.0.0.1:3306)/juicefs", | ||
want: "mysql://:dbPasswd@(127.0.0.1:3306)/juicefs", | ||
}, | ||
{ | ||
args: "mysql://:pwd@(127.0.0.1:3306)/juicefs", | ||
want: "", | ||
want: "mysql://:pwd@(127.0.0.1:3306)/juicefs", | ||
}, | ||
{ | ||
args: "mysql://a:b:c:@(127.0.0.1:3306)/juicefs", | ||
|
@@ -66,6 +67,14 @@ func Test_setPasswordFromEnv(t *testing.T) { | |
args: "postgres://[email protected]:5432/juicefs", | ||
want: "postgres://root:[email protected]:5432/juicefs", | ||
}, | ||
{ | ||
args: "postgres://root@/pgtest?host=/tmp/pgsocket/&port=5433", | ||
want: "postgres://root:dbPasswd@/pgtest?host=/tmp/pgsocket/&port=5433", | ||
}, | ||
{ | ||
args: "postgres://@/pgtest?host=/tmp/pgsocket/&port=5433&user=pguser", | ||
want: "postgres://:dbPasswd@/pgtest?host=/tmp/pgsocket/&port=5433&user=pguser", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run("", func(t *testing.T) { | ||
|