-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GODRIVER-2620 Fix hostname parsing for SRV polling. (#1112)
* GODRIVER-2620 Fix hostname parsing for SRV polling. Co-authored-by: Preston Vasquez <[email protected]> Co-authored-by: Kevin Albertson <[email protected]>
- Loading branch information
1 parent
5762c6a
commit 861364b
Showing
2 changed files
with
32 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,9 +125,22 @@ func compareHosts(t *testing.T, received []description.Server, expected []string | |
} | ||
|
||
func TestPollingSRVRecordsSpec(t *testing.T) { | ||
for _, uri := range []string{ | ||
"mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=100", | ||
// Test with user:pass as a regression test for GODRIVER-2620 | ||
"mongodb+srv://user:[email protected]/?heartbeatFrequencyMS=100", | ||
} { | ||
t.Run(uri, func(t *testing.T) { | ||
testPollingSRVRecordsSpec(t, uri) | ||
}) | ||
} | ||
} | ||
|
||
func testPollingSRVRecordsSpec(t *testing.T, uri string) { | ||
t.Helper() | ||
for _, tt := range srvPollingTests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
cs, err := connstring.ParseAndValidate("mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=100") | ||
cs, err := connstring.ParseAndValidate(uri) | ||
require.NoError(t, err, "Problem parsing the uri: %v", err) | ||
topo, err := New( | ||
WithConnString(func(connstring.ConnString) connstring.ConnString { return cs }), | ||
|
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