Skip to content
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

Add Consecutive_up and Consecutive_down for load_balancer_monitor res… #1380

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1380.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
load_balancer_monitor: add support for `consecutive_up`, `consecutive_down`
```
2 changes: 2 additions & 0 deletions load_balancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ type LoadBalancerMonitor struct {
Timeout int `json:"timeout"`
Retries int `json:"retries"`
Interval int `json:"interval"`
ConsecutiveUp int `json:"consecutive_up"`
ConsecutiveDown int `json:"consecutive_down"`
Port uint16 `json:"port,omitempty"`
ExpectedBody string `json:"expected_body"`
ExpectedCodes string `json:"expected_codes"`
Expand Down
84 changes: 54 additions & 30 deletions load_balancing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,8 @@ func TestCreateLoadBalancerMonitor(t *testing.T) {
"timeout": 3,
"retries": 0,
"interval": 90,
"consecutive_up": 2,
"consecutive_down": 2,
"expected_body": "alive",
"expected_codes": "2xx",
"follow_redirects": true,
Expand Down Expand Up @@ -653,6 +655,8 @@ func TestCreateLoadBalancerMonitor(t *testing.T) {
"timeout": 3,
"retries": 0,
"interval": 90,
"consecutive_up": 2,
"consecutive_down": 2,
"expected_body": "alive",
"expected_codes": "2xx",
"follow_redirects": true,
Expand All @@ -677,11 +681,13 @@ func TestCreateLoadBalancerMonitor(t *testing.T) {
"Host": {"example.com"},
"X-App-ID": {"abc123"},
},
Timeout: 3,
Retries: 0,
Interval: 90,
ExpectedBody: "alive",
ExpectedCodes: "2xx",
Timeout: 3,
Retries: 0,
Interval: 90,
ConsecutiveUp: 2,
ConsecutiveDown: 2,
ExpectedBody: "alive",
ExpectedCodes: "2xx",

FollowRedirects: true,
AllowInsecure: true,
Expand All @@ -695,11 +701,13 @@ func TestCreateLoadBalancerMonitor(t *testing.T) {
"Host": {"example.com"},
"X-App-ID": {"abc123"},
},
Timeout: 3,
Retries: 0,
Interval: 90,
ExpectedBody: "alive",
ExpectedCodes: "2xx",
Timeout: 3,
Retries: 0,
Interval: 90,
ConsecutiveUp: 2,
ConsecutiveDown: 2,
ExpectedBody: "alive",
ExpectedCodes: "2xx",

FollowRedirects: true,
AllowInsecure: true,
Expand Down Expand Up @@ -752,6 +760,8 @@ func TestListLoadBalancerMonitors(t *testing.T) {
"timeout": 3,
"retries": 0,
"interval": 90,
"consecutive_up": 2,
"consecutive_down": 2,
"expected_body": "alive",
"expected_codes": "2xx"
}
Expand Down Expand Up @@ -781,11 +791,13 @@ func TestListLoadBalancerMonitors(t *testing.T) {
"Host": {"example.com"},
"X-App-ID": {"abc123"},
},
Timeout: 3,
Retries: 0,
Interval: 90,
ExpectedBody: "alive",
ExpectedCodes: "2xx",
Timeout: 3,
Retries: 0,
Interval: 90,
ConsecutiveUp: 2,
ConsecutiveDown: 2,
ExpectedBody: "alive",
ExpectedCodes: "2xx",
},
}

Expand Down Expand Up @@ -835,6 +847,8 @@ func TestGetLoadBalancerMonitor(t *testing.T) {
"timeout": 3,
"retries": 0,
"interval": 90,
"consecutive_up": 2,
"consecutive_down": 2,
"expected_body": "alive",
"expected_codes": "2xx",
"follow_redirects": true,
Expand All @@ -859,11 +873,13 @@ func TestGetLoadBalancerMonitor(t *testing.T) {
"Host": {"example.com"},
"X-App-ID": {"abc123"},
},
Timeout: 3,
Retries: 0,
Interval: 90,
ExpectedBody: "alive",
ExpectedCodes: "2xx",
Timeout: 3,
Retries: 0,
Interval: 90,
ConsecutiveUp: 2,
ConsecutiveDown: 2,
ExpectedBody: "alive",
ExpectedCodes: "2xx",

FollowRedirects: true,
AllowInsecure: true,
Expand Down Expand Up @@ -947,6 +963,8 @@ func TestUpdateLoadBalancerMonitor(t *testing.T) {
"timeout": 3,
"retries": 0,
"interval": 90,
"consecutive_up": 2,
"consecutive_down": 2,
"expected_body": "kicking",
"expected_codes": "200",
"follow_redirects": true,
Expand Down Expand Up @@ -977,6 +995,8 @@ func TestUpdateLoadBalancerMonitor(t *testing.T) {
"timeout": 3,
"retries": 0,
"interval": 90,
"consecutive_up": 2,
"consecutive_down": 2,
"expected_body": "kicking",
"expected_codes": "200",
"follow_redirects": true,
Expand All @@ -1001,11 +1021,13 @@ func TestUpdateLoadBalancerMonitor(t *testing.T) {
"Host": {"example.com"},
"X-App-ID": {"easy"},
},
Timeout: 3,
Retries: 0,
Interval: 90,
ExpectedBody: "kicking",
ExpectedCodes: "200",
Timeout: 3,
Retries: 0,
Interval: 90,
ConsecutiveUp: 2,
ConsecutiveDown: 2,
ExpectedBody: "kicking",
ExpectedCodes: "200",

FollowRedirects: true,
AllowInsecure: true,
Expand All @@ -1020,11 +1042,13 @@ func TestUpdateLoadBalancerMonitor(t *testing.T) {
"Host": {"example.com"},
"X-App-ID": {"easy"},
},
Timeout: 3,
Retries: 0,
Interval: 90,
ExpectedBody: "kicking",
ExpectedCodes: "200",
Timeout: 3,
Retries: 0,
Interval: 90,
ConsecutiveUp: 2,
ConsecutiveDown: 2,
ExpectedBody: "kicking",
ExpectedCodes: "200",

FollowRedirects: true,
AllowInsecure: true,
Expand Down