This is an automated email from the ASF dual-hosted git repository.
xtsong 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 ba703da Refactor the resource cross-language test to a cross-language
test in CI. (#386)
ba703da is described below
commit ba703daa50dd7e557b0af507840c44e7816f905b
Author: Eugene <[email protected]>
AuthorDate: Fri Dec 19 15:38:26 2025 +0800
Refactor the resource cross-language test to a cross-language test in CI.
(#386)
---
.github/workflows/ci.yml | 4 +-
.../__init__.py | 0
.../chat_model_integration_agent.py | 0
.../chat_model_integration_test.py | 4 +-
.../e2e_tests_mcp/__init__.py | 0
.../e2e_tests_mcp/mcp_server.py | 0
.../e2e_tests_mcp/mcp_test.py | 0
.../flink_integration_agent.py | 0
.../flink_intergration_test.py | 14 +++----
.../python_event_logging_test.py | 2 +-
.../react_agent_test.py | 2 +-
.../react_agent_tools.py | 0
.../{ => e2e_tests_integration}/workflow_test.py | 2 +-
.../chat_model_cross_language_test.py | 3 ++
tools/e2e.sh | 46 +++++++++++-----------
tools/ut.sh | 4 +-
16 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f70936c..2f9260c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -173,6 +173,4 @@ jobs:
- name: Install ollama
run: bash tools/start_ollama_server.sh
- name: Run e2e tests
- run: |
- export PYTHONPATH="${{ github.workspace
}}/python/.venv/lib/python${{ matrix.python-version
}}/site-packages:$PYTHONPATH"
- tools/e2e.sh
\ No newline at end of file
+ run: bash tools/e2e.sh
\ No newline at end of file
diff --git a/python/flink_agents/e2e_tests/e2e_tests_mcp/__init__.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/__init__.py
similarity index 100%
copy from python/flink_agents/e2e_tests/e2e_tests_mcp/__init__.py
copy to python/flink_agents/e2e_tests/e2e_tests_integration/__init__.py
diff --git a/python/flink_agents/e2e_tests/chat_model_integration_agent.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/chat_model_integration_agent.py
similarity index 100%
rename from python/flink_agents/e2e_tests/chat_model_integration_agent.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/chat_model_integration_agent.py
diff --git a/python/flink_agents/e2e_tests/chat_model_integration_test.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/chat_model_integration_test.py
similarity index 96%
rename from python/flink_agents/e2e_tests/chat_model_integration_test.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/chat_model_integration_test.py
index b582402..93dd48f 100644
--- a/python/flink_agents/e2e_tests/chat_model_integration_test.py
+++
b/python/flink_agents/e2e_tests/e2e_tests_integration/chat_model_integration_test.py
@@ -21,7 +21,9 @@ from pathlib import Path
import pytest
from flink_agents.api.execution_environment import AgentsExecutionEnvironment
-from flink_agents.e2e_tests.chat_model_integration_agent import
ChatModelTestAgent
+from flink_agents.e2e_tests.e2e_tests_integration.chat_model_integration_agent
import (
+ ChatModelTestAgent,
+)
from flink_agents.e2e_tests.test_utils import pull_model
current_dir = Path(__file__).parent
diff --git a/python/flink_agents/e2e_tests/e2e_tests_mcp/__init__.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/e2e_tests_mcp/__init__.py
similarity index 100%
rename from python/flink_agents/e2e_tests/e2e_tests_mcp/__init__.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/e2e_tests_mcp/__init__.py
diff --git a/python/flink_agents/e2e_tests/e2e_tests_mcp/mcp_server.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/e2e_tests_mcp/mcp_server.py
similarity index 100%
rename from python/flink_agents/e2e_tests/e2e_tests_mcp/mcp_server.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/e2e_tests_mcp/mcp_server.py
diff --git a/python/flink_agents/e2e_tests/e2e_tests_mcp/mcp_test.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/e2e_tests_mcp/mcp_test.py
similarity index 100%
rename from python/flink_agents/e2e_tests/e2e_tests_mcp/mcp_test.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/e2e_tests_mcp/mcp_test.py
diff --git a/python/flink_agents/e2e_tests/flink_integration_agent.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/flink_integration_agent.py
similarity index 100%
rename from python/flink_agents/e2e_tests/flink_integration_agent.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/flink_integration_agent.py
diff --git a/python/flink_agents/e2e_tests/flink_intergration_test.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/flink_intergration_test.py
similarity index 94%
rename from python/flink_agents/e2e_tests/flink_intergration_test.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/flink_intergration_test.py
index 6647cfb..2d5a0c5 100644
--- a/python/flink_agents/e2e_tests/flink_intergration_test.py
+++
b/python/flink_agents/e2e_tests/e2e_tests_integration/flink_intergration_test.py
@@ -33,7 +33,7 @@ from pyflink.datastream.connectors.file_system import (
from pyflink.table import DataTypes, Schema, StreamTableEnvironment,
TableDescriptor
from flink_agents.api.execution_environment import AgentsExecutionEnvironment
-from flink_agents.e2e_tests.flink_integration_agent import (
+from flink_agents.e2e_tests.e2e_tests_integration.flink_integration_agent
import (
DataStreamAgent,
DataStreamToTableAgent,
ItemData,
@@ -60,7 +60,7 @@ def test_from_datastream_to_datastream(tmp_path: Path) ->
None: # noqa: D103
# we use continuous file source here.
input_datastream = env.from_source(
source=FileSource.for_record_stream_format(
- StreamFormat.text_line_format(),
f"file:///{current_dir}/resources/input"
+ StreamFormat.text_line_format(),
f"file:///{current_dir}/../resources/input"
).build(),
watermark_strategy=WatermarkStrategy.no_watermarks(),
source_name="streaming_agent_example",
@@ -94,7 +94,7 @@ def test_from_datastream_to_datastream(tmp_path: Path) ->
None: # noqa: D103
check_result(
result_dir=result_dir,
groud_truth_dir=Path(
-
f"{current_dir}/resources/ground_truth/test_from_datastream_to_datastream.txt"
+
f"{current_dir}/../resources/ground_truth/test_from_datastream_to_datastream.txt"
),
)
@@ -118,7 +118,7 @@ def test_from_table_to_table(tmp_path: Path) -> None: #
noqa: D103
.build()
)
.option("format", "json")
- .option("path", f"file:///{current_dir}/resources/input")
+ .option("path", f"file:///{current_dir}/../resources/input")
.build(),
)
@@ -169,7 +169,7 @@ def test_from_table_to_table(tmp_path: Path) -> None: #
noqa: D103
check_result(
result_dir=result_dir,
groud_truth_dir=Path(
-
f"{current_dir}/resources/ground_truth/test_from_table_to_table.txt"
+
f"{current_dir}/../resources/ground_truth/test_from_table_to_table.txt"
),
)
@@ -185,7 +185,7 @@ def test_from_datastream_to_table(tmp_path: Path) -> None:
# noqa: D103
# we use continuous file source here.
input_datastream = env.from_source(
source=FileSource.for_record_stream_format(
- StreamFormat.text_line_format(),
f"file:///{current_dir}/resources/input"
+ StreamFormat.text_line_format(),
f"file:///{current_dir}/../resources/input"
).build(),
watermark_strategy=WatermarkStrategy.no_watermarks(),
source_name="streaming_agent_example",
@@ -242,6 +242,6 @@ def test_from_datastream_to_table(tmp_path: Path) -> None:
# noqa: D103
check_result(
result_dir=result_dir,
groud_truth_dir=Path(
-
f"{current_dir}/resources/ground_truth/test_from_table_to_table.txt"
+
f"{current_dir}/../resources/ground_truth/test_from_table_to_table.txt"
),
)
diff --git a/python/flink_agents/e2e_tests/python_event_logging_test.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/python_event_logging_test.py
similarity index 98%
rename from python/flink_agents/e2e_tests/python_event_logging_test.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/python_event_logging_test.py
index 3486fa5..ae3677a 100644
--- a/python/flink_agents/e2e_tests/python_event_logging_test.py
+++
b/python/flink_agents/e2e_tests/e2e_tests_integration/python_event_logging_test.py
@@ -79,7 +79,7 @@ def test_python_event_logging() -> None:
input_datastream = env.from_source(
source=FileSource.for_record_stream_format(
StreamFormat.text_line_format(),
- f"file:///{current_dir}/resources/input/input_data.txt",
+ f"file:///{current_dir}/../resources/input/input_data.txt",
).build(),
watermark_strategy=WatermarkStrategy.no_watermarks(),
source_name="python_event_logging_test",
diff --git a/python/flink_agents/e2e_tests/react_agent_test.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_test.py
similarity index 98%
rename from python/flink_agents/e2e_tests/react_agent_test.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_test.py
index 61d0154..630a7f3 100644
--- a/python/flink_agents/e2e_tests/react_agent_test.py
+++ b/python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_test.py
@@ -37,7 +37,7 @@ from flink_agents.api.execution_environment import
AgentsExecutionEnvironment
from flink_agents.api.prompts.prompt import Prompt
from flink_agents.api.resource import ResourceDescriptor
from flink_agents.api.tools.tool import Tool
-from flink_agents.e2e_tests.react_agent_tools import add, multiply
+from flink_agents.e2e_tests.e2e_tests_integration.react_agent_tools import
add, multiply
from flink_agents.e2e_tests.test_utils import pull_model
from flink_agents.integrations.chat_models.ollama_chat_model import (
OllamaChatModelConnection,
diff --git a/python/flink_agents/e2e_tests/react_agent_tools.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_tools.py
similarity index 100%
rename from python/flink_agents/e2e_tests/react_agent_tools.py
rename to
python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_tools.py
diff --git a/python/flink_agents/e2e_tests/workflow_test.py
b/python/flink_agents/e2e_tests/e2e_tests_integration/workflow_test.py
similarity index 98%
rename from python/flink_agents/e2e_tests/workflow_test.py
rename to python/flink_agents/e2e_tests/e2e_tests_integration/workflow_test.py
index 5e8a729..1cabe92 100644
--- a/python/flink_agents/e2e_tests/workflow_test.py
+++ b/python/flink_agents/e2e_tests/e2e_tests_integration/workflow_test.py
@@ -113,7 +113,7 @@ def test_workflow() -> None: # noqa: D103
expected_output = []
with Path.open(
- Path(f"{current_dir}/resources/ground_truth/test_workflow.txt")
+ Path(f"{current_dir}/../resources/ground_truth/test_workflow.txt")
) as f:
for line in f:
expected_output.append(json.loads(line)) # noqa:PERF401
diff --git
a/python/flink_agents/e2e_tests/e2e_tests_resource_cross_language/chat_model_cross_language_test.py
b/python/flink_agents/e2e_tests/e2e_tests_resource_cross_language/chat_model_cross_language_test.py
index 3ff79cd..9cf1690 100644
---
a/python/flink_agents/e2e_tests/e2e_tests_resource_cross_language/chat_model_cross_language_test.py
+++
b/python/flink_agents/e2e_tests/e2e_tests_resource_cross_language/chat_model_cross_language_test.py
@@ -16,6 +16,7 @@
# limitations under the License.
#################################################################################
import os
+import sysconfig
from pathlib import Path
import pytest
@@ -44,6 +45,8 @@ os.environ["OLLAMA_CHAT_MODEL"] = OLLAMA_MODEL
client = pull_model(OLLAMA_MODEL)
+os.environ["PYTHONPATH"] = sysconfig.get_paths()["purelib"]
+
@pytest.mark.skipif(client is None, reason="Ollama client is not available or
test model is missing.")
def test_java_chat_model_integration(tmp_path: Path) -> None: # noqa: D103
env = StreamExecutionEnvironment.get_execution_environment()
diff --git a/tools/e2e.sh b/tools/e2e.sh
index f244bc0..d48f18e 100755
--- a/tools/e2e.sh
+++ b/tools/e2e.sh
@@ -35,49 +35,55 @@ function run_test {
fi
}
-function run_python_test {
- local test_script="$1"
- shift
- local args=("$@")
+function run_agent_plan_compatibility_test {
if [[ ! -d "$python_dir" ]]; then
echo "Error: Python directory '$python_dir' does not exist. Skipping test."
return 1
fi
- cd "$python_dir" && uv run bash "$test_script" "${args[@]}"
+ cd "$python_dir" && uv run --no-sync bash
../e2e-test/test-scripts/test_agent_plan_compatibility.sh "$tempdir" "$jar_path"
}
-function run_agent_plan_compatibility_test {
+function run_cross_language_config_test {
if [[ ! -d "$python_dir" ]]; then
echo "Error: Python directory '$python_dir' does not exist. Skipping test."
return 1
fi
- cd "$python_dir" && uv run bash
../e2e-test/test-scripts/test_agent_plan_compatibility.sh "$tempdir" "$jar_path"
+ cd "$python_dir" && uv run --no-sync bash
../e2e-test/test-scripts/test_java_config_in_python.sh
}
-function run_cross_language_config_test {
+function run_resource_cross_language_test_in_java {
if [[ ! -d "$python_dir" ]]; then
echo "Error: Python directory '$python_dir' does not exist. Skipping test."
return 1
fi
- cd "$python_dir" && uv run bash
../e2e-test/test-scripts/test_java_config_in_python.sh
+ cd "$python_dir"
+
+ # Get Python version from uv's virtual environment and set PYTHONPATH
+ local python_version=$(uv run --no-sync python -c "import sys;
print(f'python{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null)
+ if [[ -n "$python_version" ]]; then
+ export
PYTHONPATH="$python_dir/.venv/lib/$python_version/site-packages:$PYTHONPATH"
+ echo "PYTHONPATH set to: $PYTHONPATH"
+ fi
+
+ uv run --no-sync bash
../e2e-test/test-scripts/test_resource_cross_language.sh
}
-function run_resource_cross_language_test {
- # This test only runs Maven, no need for Python environment
- # Ensure we're in the project root directory
- cd "$project_root"
- uv run bash e2e-test/test-scripts/test_resource_cross_language.sh
+function run_resource_cross_language_test_in_python {
+ if [[ ! -d "$python_dir" ]]; then
+ echo "Error: Python directory '$python_dir' does not exist. Skipping
test."
+ return 1
+ fi
+
+ cd "$python_dir" && uv run --no-sync pytest flink_agents -s -k
"e2e_tests_resource_cross_language"
}
export TOTAL=0
export PASSED=0
-run_test "Resource Cross-Language end-to-end test"
"run_resource_cross_language_test"
-
if [[ ! -d "e2e-test/target" ]]; then
echo "Build flink-agents before run e2e tests."
bash tools/build.sh
@@ -101,9 +107,6 @@ if [[ ! -f "uv.lock" ]]; then
cd python
fi
-# Sync dependencies and ensure flink_agents is installed in editable mode
-uv sync --extra dev
-uv pip install -e .
cd ..
# Create temporary directory with better cross-platform compatibility
@@ -137,9 +140,8 @@ if [[ ! -d "$python_dir" ]]; then
exit 1
fi
-# Set up environment variables for uv
-export PYTHONPATH="$(pwd)/python"
-
+run_test "Resource Cross-Language end-to-end test in Java"
"run_resource_cross_language_test_in_java"
+run_test "Resource Cross-Language end-to-end test in Python"
"run_resource_cross_language_test_in_python"
run_test "Agent plan compatibility end-to-end test"
"run_agent_plan_compatibility_test"
run_test "Cross-Language Config Option end-to-end test"
"run_cross_language_config_test"
diff --git a/tools/ut.sh b/tools/ut.sh
index e172b0c..ee43037 100755
--- a/tools/ut.sh
+++ b/tools/ut.sh
@@ -142,7 +142,7 @@ python_tests() {
fi
if $run_e2e; then
# There will be an individual build step before run e2e test for
including java dist
- uv run --no-sync pytest flink_agents -s -k "e2e_tests"
+ uv run --no-sync pytest flink_agents -s -k "e2e_tests_integration"
else
uv sync --extra test
uv run pytest flink_agents -k "not e2e_tests"
@@ -168,7 +168,7 @@ python_tests() {
echo "Running tests with pytest..."
fi
if $run_e2e; then
- pytest flink_agents -k "e2e_tests"
+ pytest flink_agents -k "e2e_tests_integration"
else
pytest flink_agents -k "not e2e_tests"
fi