From 0209c300c58848650cf0345405ba19bf53c1fd13 Mon Sep 17 00:00:00 2001 From: zirain Date: Sun, 22 Jun 2025 10:11:24 +0800 Subject: [PATCH 1/2] e2e: use different qps for BackendUpgrade test Signed-off-by: zirain --- .github/workflows/build_and_test.yaml | 8 ++++++++ test/e2e/tests/backend_upgrade.go | 12 ++++++------ test/e2e/tests/utils.go | 12 +++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index cb24e5752c..97dcf1aebd 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -136,19 +136,24 @@ jobs: - version: v1.30.10 ipFamily: ipv4 profile: default + loadQPS: 1000 - version: v1.31.6 ipFamily: ipv4 profile: default + loadQPS: 2000 - version: v1.32.3 ipFamily: ipv6 # only run ipv6 test on this version to save time profile: default + loadQPS: 3000 # TODO: this's IPv4 first, need a way to test IPv6 first. - version: v1.33.0 ipFamily: dual # only run dual test on latest version to save time profile: default + loadQPS: 4000 - version: v1.33.0 ipFamily: dual # only run dual test on latest version to save time profile: gateway-namespace-mode + loadQPS: 5000 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: ./tools/github-actions/setup-deps @@ -172,6 +177,9 @@ jobs: IP_FAMILY: ${{ matrix.target.ipFamily }} KUBE_DEPLOY_PROFILE: ${{ matrix.target.profile }} E2E_TIMEOUT: 1h + # use the loadQPS from the matrix to set the QPS for the E2E tests + # this is used to determine whether the flaky tests are due to load or not + E2E_BACKEND_UPGRADE_QPS: ${{ matrix.target.loadQPS }} NUM_WORKERS: 2 run: make e2e diff --git a/test/e2e/tests/backend_upgrade.go b/test/e2e/tests/backend_upgrade.go index 78fd1f36e6..11fe6dafd6 100644 --- a/test/e2e/tests/backend_upgrade.go +++ b/test/e2e/tests/backend_upgrade.go @@ -10,6 +10,7 @@ package tests import ( "context" "net/url" + "sigs.k8s.io/gateway-api/conformance/utils/tlog" "testing" "time" @@ -65,24 +66,23 @@ var BackendUpgradeTest = suite.ConformanceTest{ // will contain indication on success or failure of load test loadSuccess := make(chan bool) - t.Log("Starting load generation") + tlog.Logf(t, "Starting load generation") // Run load async and continue to restart deployment go runLoadAndWait(t, suite.TimeoutConfig, loadSuccess, aborter, reqURL.String()) - t.Log("Restarting deployment") + tlog.Logf(t, "Restarting deployment") err = restartDeploymentAndWaitForNewPods(t, suite.TimeoutConfig, suite.Client, dp) - t.Log("Stopping load generation and collecting results") + tlog.Logf(t, "Stopping load generation and collecting results") aborter.Abort(false) // abort the load either way - if err != nil { - t.Errorf("Failed to restart deployment") + tlog.Errorf(t, "Failed to restart deployment") } // Wait for the goroutine to finish result := <-loadSuccess if !result { - t.Errorf("Load test failed") + tlog.Errorf(t, "Load test failed") } }) }, diff --git a/test/e2e/tests/utils.go b/test/e2e/tests/utils.go index 83f5319ecb..fbd5f075da 100644 --- a/test/e2e/tests/utils.go +++ b/test/e2e/tests/utils.go @@ -241,10 +241,20 @@ func AlmostEquals(actual, expect, offset int) bool { // the done channel is used to notify caller of execution result // the execution may end due to an external abort or timeout func runLoadAndWait(t *testing.T, timeoutConfig config.TimeoutConfig, done chan bool, aborter *periodic.Aborter, reqURL string) { + qpsVal := os.Getenv("E2E_BACKEND_UPGRADE_QPS") + qps := 5000 + if qpsVal != "" { + if v, err := strconv.Atoi(qpsVal); err == nil { + qps = v + } else { + tlog.Logf(t, "Invalid QPS value %s, using default %d", qpsVal, qps) + } + } + flog.SetLogLevel(flog.Error) opts := fhttp.HTTPRunnerOptions{ RunnerOptions: periodic.RunnerOptions{ - QPS: 5000, + QPS: float64(qps), // allow some overhead time for setting up workers and tearing down after restart Duration: timeoutConfig.CreateTimeout + timeoutConfig.CreateTimeout/2, NumThreads: 50, From 8a508d59fa800970154b9525635fb6f1cf097549 Mon Sep 17 00:00:00 2001 From: zirain Date: Sun, 22 Jun 2025 10:18:15 +0800 Subject: [PATCH 2/2] fix Signed-off-by: zirain --- test/e2e/tests/backend_upgrade.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/tests/backend_upgrade.go b/test/e2e/tests/backend_upgrade.go index 11fe6dafd6..ef22c3fcec 100644 --- a/test/e2e/tests/backend_upgrade.go +++ b/test/e2e/tests/backend_upgrade.go @@ -10,7 +10,6 @@ package tests import ( "context" "net/url" - "sigs.k8s.io/gateway-api/conformance/utils/tlog" "testing" "time" @@ -25,6 +24,7 @@ import ( "sigs.k8s.io/gateway-api/conformance/utils/http" "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" "sigs.k8s.io/gateway-api/conformance/utils/suite" + "sigs.k8s.io/gateway-api/conformance/utils/tlog" ) func init() {