-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GODRIVER-1778 Reject HeartbeatFrequencyMS of less than 500ms (#1828)
- Loading branch information
Showing
6 changed files
with
74 additions
and
14 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 |
---|---|---|
|
@@ -127,9 +127,9 @@ 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", | ||
"mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=500", | ||
// Test with user:pass as a regression test for GODRIVER-2620 | ||
"mongodb+srv://user:[email protected]/?heartbeatFrequencyMS=100", | ||
"mongodb+srv://user:[email protected]/?heartbeatFrequencyMS=500", | ||
} { | ||
t.Run(uri, func(t *testing.T) { | ||
testPollingSRVRecordsSpec(t, uri) | ||
|
@@ -169,7 +169,7 @@ func testPollingSRVRecordsSpec(t *testing.T, uri string) { | |
|
||
func TestPollSRVRecords(t *testing.T) { | ||
t.Run("Not unknown or sharded topology", func(t *testing.T) { | ||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=100" | ||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=500" | ||
cfg, err := NewConfig(options.Client().ApplyURI(uri), nil) | ||
require.NoError(t, err, "error constructing topology config: %v", err) | ||
|
||
|
@@ -207,7 +207,7 @@ func TestPollSRVRecords(t *testing.T) { | |
|
||
}) | ||
t.Run("Failed Hostname Verification", func(t *testing.T) { | ||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=100" | ||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=500" | ||
cfg, err := NewConfig(options.Client().ApplyURI(uri), nil) | ||
require.NoError(t, err, "error constructing topology config: %v", err) | ||
|
||
|
@@ -234,7 +234,7 @@ func TestPollSRVRecords(t *testing.T) { | |
|
||
}) | ||
t.Run("Return to polling time", func(t *testing.T) { | ||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=100" | ||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=500" | ||
cfg, err := NewConfig(options.Client().ApplyURI(uri), nil) | ||
require.NoError(t, err, "error constructing topology config: %v", err) | ||
|
||
|
@@ -276,7 +276,7 @@ func TestPollingSRVRecordsLoadBalanced(t *testing.T) { | |
} | ||
|
||
t.Run("pollingRequired is set to false", func(t *testing.T) { | ||
topo := createLBTopology(t, "mongodb+srv://test24.test.build.10gen.cc/?heartbeatFrequencyMS=100") | ||
topo := createLBTopology(t, "mongodb+srv://test24.test.build.10gen.cc/?heartbeatFrequencyMS=500") | ||
assert.False(t, topo.pollingRequired, "expected SRV polling to not be required, but it is") | ||
}) | ||
|
||
|
@@ -313,7 +313,7 @@ func TestPollSRVRecordsMaxHosts(t *testing.T) { | |
simulateSRVPoll := func(srvMaxHosts int, recordsToAdd []*net.SRV, recordsToRemove []*net.SRV) (*Topology, func(ctx context.Context) error) { | ||
t.Helper() | ||
|
||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=100" | ||
uri := "mongodb+srv://test1.test.build.10gen.cc/?heartbeatFrequencyMS=500" | ||
cfg, err := NewConfig(options.Client().ApplyURI(uri).SetSRVMaxHosts(srvMaxHosts), nil) | ||
require.NoError(t, err, "error constructing topology config: %v", err) | ||
|
||
|
@@ -385,7 +385,7 @@ func TestPollSRVRecordsServiceName(t *testing.T) { | |
simulateSRVPoll := func(srvServiceName string, recordsToAdd []*net.SRV, recordsToRemove []*net.SRV) (*Topology, func(ctx context.Context) error) { | ||
t.Helper() | ||
|
||
uri := "mongodb+srv://test22.test.build.10gen.cc/?heartbeatFrequencyMS=100&srvServiceName=customname" | ||
uri := "mongodb+srv://test22.test.build.10gen.cc/?heartbeatFrequencyMS=500&srvServiceName=customname" | ||
cfg, err := NewConfig(options.Client().ApplyURI(uri).SetSRVServiceName(srvServiceName), nil) | ||
require.NoError(t, err, "error constructing topology config: %v", err) | ||
|
||
|