Skip to content

Commit 9453572

Browse files
authored
e2e: use different QPS for BackendUpgrade test (envoyproxy#6373)
* e2e: use different qps for BackendUpgrade test Signed-off-by: zirain <zirain2009@gmail.com> * fix Signed-off-by: zirain <zirain2009@gmail.com> --------- Signed-off-by: zirain <zirain2009@gmail.com>
1 parent 40e3d6e commit 9453572

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.github/workflows/build_and_test.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,24 @@ jobs:
136136
- version: v1.30.10
137137
ipFamily: ipv4
138138
profile: default
139+
loadQPS: 1000
139140
- version: v1.31.6
140141
ipFamily: ipv4
141142
profile: default
143+
loadQPS: 2000
142144
- version: v1.32.3
143145
ipFamily: ipv6 # only run ipv6 test on this version to save time
144146
profile: default
147+
loadQPS: 3000
145148
# TODO: this's IPv4 first, need a way to test IPv6 first.
146149
- version: v1.33.0
147150
ipFamily: dual # only run dual test on latest version to save time
148151
profile: default
152+
loadQPS: 4000
149153
- version: v1.33.0
150154
ipFamily: dual # only run dual test on latest version to save time
151155
profile: gateway-namespace-mode
156+
loadQPS: 5000
152157
steps:
153158
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
154159
- uses: ./tools/github-actions/setup-deps
@@ -172,6 +177,9 @@ jobs:
172177
IP_FAMILY: ${{ matrix.target.ipFamily }}
173178
KUBE_DEPLOY_PROFILE: ${{ matrix.target.profile }}
174179
E2E_TIMEOUT: 1h
180+
# use the loadQPS from the matrix to set the QPS for the E2E tests
181+
# this is used to determine whether the flaky tests are due to load or not
182+
E2E_BACKEND_UPGRADE_QPS: ${{ matrix.target.loadQPS }}
175183
NUM_WORKERS: 2
176184
run: make e2e
177185

test/e2e/tests/backend_upgrade.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"sigs.k8s.io/gateway-api/conformance/utils/http"
2525
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
2626
"sigs.k8s.io/gateway-api/conformance/utils/suite"
27+
"sigs.k8s.io/gateway-api/conformance/utils/tlog"
2728
)
2829

2930
func init() {
@@ -65,24 +66,23 @@ var BackendUpgradeTest = suite.ConformanceTest{
6566
// will contain indication on success or failure of load test
6667
loadSuccess := make(chan bool)
6768

68-
t.Log("Starting load generation")
69+
tlog.Logf(t, "Starting load generation")
6970
// Run load async and continue to restart deployment
7071
go runLoadAndWait(t, suite.TimeoutConfig, loadSuccess, aborter, reqURL.String())
7172

72-
t.Log("Restarting deployment")
73+
tlog.Logf(t, "Restarting deployment")
7374
err = restartDeploymentAndWaitForNewPods(t, suite.TimeoutConfig, suite.Client, dp)
7475

75-
t.Log("Stopping load generation and collecting results")
76+
tlog.Logf(t, "Stopping load generation and collecting results")
7677
aborter.Abort(false) // abort the load either way
77-
7878
if err != nil {
79-
t.Errorf("Failed to restart deployment")
79+
tlog.Errorf(t, "Failed to restart deployment")
8080
}
8181

8282
// Wait for the goroutine to finish
8383
result := <-loadSuccess
8484
if !result {
85-
t.Errorf("Load test failed")
85+
tlog.Errorf(t, "Load test failed")
8686
}
8787
})
8888
},

test/e2e/tests/utils.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,20 @@ func AlmostEquals(actual, expect, offset int) bool {
241241
// the done channel is used to notify caller of execution result
242242
// the execution may end due to an external abort or timeout
243243
func runLoadAndWait(t *testing.T, timeoutConfig config.TimeoutConfig, done chan bool, aborter *periodic.Aborter, reqURL string) {
244+
qpsVal := os.Getenv("E2E_BACKEND_UPGRADE_QPS")
245+
qps := 5000
246+
if qpsVal != "" {
247+
if v, err := strconv.Atoi(qpsVal); err == nil {
248+
qps = v
249+
} else {
250+
tlog.Logf(t, "Invalid QPS value %s, using default %d", qpsVal, qps)
251+
}
252+
}
253+
244254
flog.SetLogLevel(flog.Error)
245255
opts := fhttp.HTTPRunnerOptions{
246256
RunnerOptions: periodic.RunnerOptions{
247-
QPS: 5000,
257+
QPS: float64(qps),
248258
// allow some overhead time for setting up workers and tearing down after restart
249259
Duration: timeoutConfig.CreateTimeout + timeoutConfig.CreateTimeout/2,
250260
NumThreads: 50,

0 commit comments

Comments
 (0)