This is an automated email from the ASF dual-hosted git repository.

wenjin272 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/main by this push:
     new f5cf5956 [hotfix][e2e] Derive recovery test version from project 
(#1041)
f5cf5956 is described below

commit f5cf59567246bc661969b717283e26510ec34c27
Author: Wenjin Xie <[email protected]>
AuthorDate: Mon Aug 24 09:55:49 2026 +0800

    [hotfix][e2e] Derive recovery test version from project (#1041)
    
    Read the expected Flink Agents version from python/pyproject.toml so the 
nightly recovery test follows release-line version updates. Add regression 
coverage for the derived default.
    
    Generated-by: Codex CLI 0.144.5 (GPT-5.6-sol)
---
 e2e-test/test-scripts/test_checkpoint_recovery.sh | 23 +++++++++++++++++++----
 tools/test/helpers/recovery.bash                  |  1 -
 tools/test/unit/checkpoint_recovery_harness.bats  | 12 ++++++++++++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/e2e-test/test-scripts/test_checkpoint_recovery.sh 
b/e2e-test/test-scripts/test_checkpoint_recovery.sh
index ba88e37b..cd22f838 100755
--- a/e2e-test/test-scripts/test_checkpoint_recovery.sh
+++ b/e2e-test/test-scripts/test_checkpoint_recovery.sh
@@ -66,7 +66,22 @@ FLINK_MAJOR_MINOR="${FLINK_VERSION%.*}"
 REST_URL="${REST_URL:-http://localhost:8081}";
 
 
JOB_MODULE="flink_agents/e2e_tests/e2e_tests_integration/checkpoint_recovery_job.py"
-EXPECTED_AGENTS_VERSION="${EXPECTED_AGENTS_VERSION:-0.3.dev0}"
+
+read_agents_project_version() {
+    local pyproject="$ROOT_DIR/python/pyproject.toml"
+    local version
+    version=$(sed -n 's/^version = "\([^"]*\)"$/\1/p' "$pyproject" | head -n 1)
+    if [[ -z "$version" ]]; then
+        log_error "Could not read the project version from $pyproject"
+        return 1
+    fi
+    printf '%s' "$version"
+}
+
+# Read the expected version from the checkout rather than pinning a 
release-line
+# value here. The assertion below then proves that the distribution metadata 
the
+# TaskManager imported belongs to the same source tree this run built.
+EXPECTED_AGENTS_VERSION="${EXPECTED_AGENTS_VERSION:-$(read_agents_project_version)}"
 
 # Checkpoint interval is deliberately short: the run is parked while we wait 
for two
 # checkpoints to complete, and that wait is charged against the tool's own 
deadline.
@@ -1034,9 +1049,9 @@ assert_runtime_identity() {
     fi
 
     # The version alone comes from distribution metadata and cannot tell two 
trees
-    # apart that both call themselves 0.3.dev0 — an installed wheel and this 
working
-    # tree would report the same string. The api-file probe is what identifies 
the
-    # tree, so assert it points inside the checkout -pypath was pointed at.
+    # apart when they declare the same project version — an installed wheel 
and this
+    # working tree would report the same string. The api-file probe is what 
identifies
+    # the tree, so assert it points inside the checkout -pypath was pointed at.
     local expected_prefix="$ROOT_DIR/python/flink_agents/api/"
     if [[ "$module_file" != "$expected_prefix"* ]]; then
         log_error "runtime-identity: the TaskManager imported flink_agents.api 
from '$module_file', which is not under '$expected_prefix'. The job exercised a 
different copy of the code than the one in this checkout, so a pass would not 
be evidence about these sources."
diff --git a/tools/test/helpers/recovery.bash b/tools/test/helpers/recovery.bash
index f5c806b3..fd1439ac 100644
--- a/tools/test/helpers/recovery.bash
+++ b/tools/test/helpers/recovery.bash
@@ -49,7 +49,6 @@ reset_recovery_sh_state() {
     CHECKPOINT_INTERVAL_MS="5000"
     RESTART_ATTEMPTS="3"
     STANDALONE_STARTUP_TIME="600s"
-    EXPECTED_AGENTS_VERSION="0.3.dev0"
     # Keep the polls short; every wait under test is given a small budget.
     POLL_INTERVAL=1
 }
diff --git a/tools/test/unit/checkpoint_recovery_harness.bats 
b/tools/test/unit/checkpoint_recovery_harness.bats
index 4eaff1fe..a9a733c0 100644
--- a/tools/test/unit/checkpoint_recovery_harness.bats
+++ b/tools/test/unit/checkpoint_recovery_harness.bats
@@ -20,10 +20,22 @@ bats_require_minimum_version 1.5.0
 
 setup() {
     load '../helpers/recovery'
+    # The production script supports an explicit override, but unit tests must
+    # exercise its default: deriving the expectation from this checkout.
+    unset EXPECTED_AGENTS_VERSION
     load_recovery_sh
     reset_recovery_sh_state
 }
 
+@test "runtime identity: expected version follows the current Python project" {
+    local declared_version
+    declared_version=$(sed -n 's/^version = "\([^"]*\)"$/\1/p' \
+        "$REPO_ROOT/python/pyproject.toml" | head -n 1)
+
+    [ -n "$declared_version" ]
+    [ "$EXPECTED_AGENTS_VERSION" = "$declared_version" ]
+}
+
 # ---------------------------------------------------------------------------
 # json_query — reading values
 # ---------------------------------------------------------------------------

Reply via email to