-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GODRIVER-1778 Reject HeartbeatFrequencyMS of less than 500ms #1828
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ef71d5f
add validation for heartbeat
joyjwang 80896d5
change default from 50 to 500 ms
joyjwang 6a74ab1
change lowHeartbeatFrequency from 50 to 500ms
joyjwang 2a00a8b
change reducedHeartbeatInterval from 100 to 500ms
joyjwang 85212ca
altering polling_srv_records
joyjwang 033a4b9
add tests
joyjwang e27cfc2
change test typo
joyjwang 9a947a3
move tests and alter error messages
joyjwang a7de79c
back to assert.Equal
joyjwang 3d83d20
improve test readability
joyjwang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the history of the original 50ms default? Does the 500ms requirement conflict with legacy test specifications? Or was this value chosen arbitrarily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it came from this commit to implement streaming heartbeat protocol, not sure how the value was chosen though.