Skip to content

A programming framework for agentic AI

Split out GRPC tests (#5431)

Jack Gerritsf7f5507c700f
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 53b5d93e3..56a0f0213 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -149,6 +149,38 @@ jobs:
name: coverage-${{ env.PKG_NAME }}
path: ./python/coverage_${{ env.PKG_NAME }}.xml
+ test-grpc:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: astral-sh/setup-uv@v5
+ with:
+ enable-cache: true
+ version: "0.5.18"
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.11"
+ - name: Run uv sync
+ run: |
+ uv sync --locked --all-extras
+ working-directory: ./python
+ - name: Run task
+ run: |
+ source ${{ github.workspace }}/python/.venv/bin/activate
+ poe --directory ./packages/autogen-ext test-grpc
+ working-directory: ./python
+
+ - name: Move coverage file
+ run: |
+ mv ./packages/autogen-ext/coverage.xml coverage_autogen-ext-grpc.xml
+ working-directory: ./python
+
+ - name: Upload coverage artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: coverage-autogen-ext-grpc
+ path: ./python/coverage_autogen-ext-grpc.xml
+
codecov:
runs-on: ubuntu-latest
needs: [test]
@@ -159,6 +191,7 @@ jobs:
"./packages/autogen-core",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
+ "autogen-ext-grpc",
]
steps:
- uses: actions/checkout@v4
diff --git a/python/packages/autogen-ext/conftest.py b/python/packages/autogen-ext/conftest.py
new file mode 100644
index 000000000..a458f1548
--- /dev/null
+++ b/python/packages/autogen-ext/conftest.py
@@ -0,0 +1,17 @@
+import pytest
+
+def pytest_addoption(parser):
+ parser.addoption(
+ "--grpc", action="store_true", default=False, help="run grpc tests"
+ )
+
+def pytest_collection_modifyitems(config, items):
+ grpc_option_passed = config.getoption("--grpc")
+ skip_grpc = pytest.mark.skip(reason="Need --grpc option to run")
+ skip_non_grpc = pytest.mark.skip(reason="Skipped since --grpc passed")
+
+ for item in items:
+ if "grpc" in item.keywords and not grpc_option_passed:
+ item.add_marker(skip_grpc)
+ elif "grpc" not in item.keywords and grpc_option_passed:
+ item.add_marker(skip_non_grpc)
diff --git a/python/packages/autogen-ext/pyproject.toml b/python/packages/autogen-ext/pyproject.toml
index e20c0dae9..a2ffda98a 100644
--- a/python/packages/autogen-ext/pyproject.toml
+++ b/python/packages/autogen-ext/pyproject.toml
@@ -136,6 +136,9 @@ exclude = ["src/autogen_ext/runtimes/grpc/protos", "tests/protos"]
[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["tests"]
+markers = [
+ "grpc",
+]
[tool.poe]
include = "../../shared_tasks.toml"
@@ -146,6 +149,7 @@ test.sequence = [
"pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml",
]
test.default_item_type = "cmd"
+test-grpc = "pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml --grpc"
mypy = "mypy --config-file ../../pyproject.toml --exclude src/autogen_ext/runtimes/grpc/protos --exclude tests/protos src tests"
[tool.mypy]
diff --git a/python/packages/autogen-ext/tests/test_worker_runtime.py b/python/packages/autogen-ext/tests/test_worker_runtime.py
index e7f62f19d..77101d134 100644
--- a/python/packages/autogen-ext/tests/test_worker_runtime.py
+++ b/python/packages/autogen-ext/tests/test_worker_runtime.py
@@ -32,6 +32,7 @@ from autogen_test_utils import (
from protos.serialization_test_pb2 import ProtoMessage
@pytest.mark.asyncio
async def test_agent_types_must_be_unique_single_worker() -> None:
host_address = "localhost:50051"
@@ -54,6 +55,7 @@ async def test_agent_types_must_be_unique_single_worker() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_agent_types_must_be_unique_multiple_workers() -> None:
host_address = "localhost:50052"
@@ -79,6 +81,7 @@ async def test_agent_types_must_be_unique_multiple_workers() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_register_receives_publish() -> None:
host_address = "localhost:50053"
@@ -124,6 +127,7 @@ async def test_register_receives_publish() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_register_receives_publish_cascade_single_worker() -> None:
host_address = "localhost:50054"
@@ -159,6 +163,7 @@ async def test_register_receives_publish_cascade_single_worker() -> None:
await host.stop()
@pytest.mark.skip(reason="Fix flakiness")
@pytest.mark.asyncio
async def test_register_receives_publish_cascade_multiple_workers() -> None:
@@ -204,6 +209,7 @@ async def test_register_receives_publish_cascade_multiple_workers() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_default_subscription() -> None:
host_address = "localhost:50056"
@@ -238,6 +244,7 @@ async def test_default_subscription() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_default_subscription_other_source() -> None:
host_address = "localhost:50057"
@@ -272,6 +279,7 @@ async def test_default_subscription_other_source() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_type_subscription() -> None:
host_address = "localhost:50058"
@@ -309,6 +317,7 @@ async def test_type_subscription() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_duplicate_subscription() -> None:
host_address = "localhost:50059"
@@ -340,6 +349,7 @@ async def test_duplicate_subscription() -> None:
await host.stop()
@pytest.mark.asyncio
async def test_disconnected_agent() -> None:
host_address = "localhost:50060"
@@ -418,6 +428,7 @@ class ProtoReceivingAgent(RoutedAgent):
self.received_messages.append(message)
@pytest.mark.asyncio
async def test_proto_payloads() -> None:
host_address = "localhost:50057"
@@ -461,6 +472,7 @@ async def test_proto_payloads() -> None:
# TODO add tests for failure to deserialize
@pytest.mark.asyncio
async def test_grpc_max_message_size() -> None:
default_max_size = 2**22