-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support the random load balancing method #376
Merged
+38
−11
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ func TestParseLBMethod(t *testing.T) { | |
{"least_conn", "least_conn"}, | ||
{"round_robin", ""}, | ||
{"ip_hash", "ip_hash"}, | ||
{"random", "random"}, | ||
{"random two", "random two"}, | ||
{"random two least_conn", "random two least_conn"}, | ||
{"hash $request_id", "hash $request_id"}, | ||
{"hash $request_id consistent", "hash $request_id consistent"}, | ||
} | ||
|
@@ -20,6 +23,10 @@ func TestParseLBMethod(t *testing.T) { | |
"least_time header", | ||
"hash123", | ||
"hash $request_id conwrongspelling", | ||
"random one", | ||
"random two least_time=header", | ||
"random two least_time=last_byte", | ||
"random two ip_hash", | ||
} | ||
|
||
for _, test := range testsWithValidInput { | ||
|
@@ -49,6 +56,11 @@ func TestParseLBMethodForPlus(t *testing.T) { | |
{"least_conn", "least_conn"}, | ||
{"round_robin", ""}, | ||
{"ip_hash", "ip_hash"}, | ||
{"random", "random"}, | ||
{"random two", "random two"}, | ||
{"random two least_conn", "random two least_conn"}, | ||
{"random two least_time=header", "random two least_time=header"}, | ||
{"random two least_time=last_byte", "random two least_time=last_byte"}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please also test on some of invalid input: |
||
{"hash $request_id", "hash $request_id"}, | ||
{"least_time header", "least_time header"}, | ||
{"least_time last_byte", "least_time last_byte"}, | ||
|
@@ -61,6 +73,9 @@ func TestParseLBMethodForPlus(t *testing.T) { | |
"blabla", | ||
"hash123", | ||
"least_time inflight header", | ||
"random one", | ||
"random two ip_hash", | ||
"random two least_time", | ||
} | ||
|
||
for _, test := range testsWithValidInput { | ||
|
@@ -82,7 +97,6 @@ func TestParseLBMethodForPlus(t *testing.T) { | |
} | ||
} | ||
|
||
|
||
func TestParseSlowStart(t *testing.T) { | ||
var testsWithValidInput = []string{"1", "1m10s", "11 11", "5m 30s", "1s", "100m", "5w", "15m", "11M", "3h", "100y", "600"} | ||
var invalidInput = []string{"ss", "rM", "m0m", "s1s", "-5s", "", "1L"} | ||
|
@@ -101,4 +115,4 @@ func TestParseSlowStart(t *testing.T) { | |
t.Errorf("TestParseSlowStart(%q) didn't return error. Returned: %q", test, result) | ||
} | ||
} | ||
} | ||
} |
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.
please also test for some of invalid input:
random one
,random two ip_hash
,random two least_time