mirror of
https://github.com/microsoft/autogen.git
synced 2025-06-26 22:30:10 +00:00
Split out GRPC tests (#5431)
This commit is contained in:
parent
362d6a4e6b
commit
f7f5507c70
33
.github/workflows/checks.yml
vendored
33
.github/workflows/checks.yml
vendored
@ -149,6 +149,38 @@ jobs:
|
|||||||
name: coverage-${{ env.PKG_NAME }}
|
name: coverage-${{ env.PKG_NAME }}
|
||||||
path: ./python/coverage_${{ env.PKG_NAME }}.xml
|
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:
|
codecov:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [test]
|
needs: [test]
|
||||||
@ -159,6 +191,7 @@ jobs:
|
|||||||
"./packages/autogen-core",
|
"./packages/autogen-core",
|
||||||
"./packages/autogen-ext",
|
"./packages/autogen-ext",
|
||||||
"./packages/autogen-agentchat",
|
"./packages/autogen-agentchat",
|
||||||
|
"autogen-ext-grpc",
|
||||||
]
|
]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
17
python/packages/autogen-ext/conftest.py
Normal file
17
python/packages/autogen-ext/conftest.py
Normal file
@ -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)
|
@ -136,6 +136,9 @@ exclude = ["src/autogen_ext/runtimes/grpc/protos", "tests/protos"]
|
|||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
minversion = "6.0"
|
minversion = "6.0"
|
||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
|
markers = [
|
||||||
|
"grpc",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.poe]
|
[tool.poe]
|
||||||
include = "../../shared_tasks.toml"
|
include = "../../shared_tasks.toml"
|
||||||
@ -146,6 +149,7 @@ test.sequence = [
|
|||||||
"pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml",
|
"pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml",
|
||||||
]
|
]
|
||||||
test.default_item_type = "cmd"
|
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"
|
mypy = "mypy --config-file ../../pyproject.toml --exclude src/autogen_ext/runtimes/grpc/protos --exclude tests/protos src tests"
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
|
@ -32,6 +32,7 @@ from autogen_test_utils import (
|
|||||||
from protos.serialization_test_pb2 import ProtoMessage
|
from protos.serialization_test_pb2 import ProtoMessage
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_agent_types_must_be_unique_single_worker() -> None:
|
async def test_agent_types_must_be_unique_single_worker() -> None:
|
||||||
host_address = "localhost:50051"
|
host_address = "localhost:50051"
|
||||||
@ -54,6 +55,7 @@ async def test_agent_types_must_be_unique_single_worker() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_agent_types_must_be_unique_multiple_workers() -> None:
|
async def test_agent_types_must_be_unique_multiple_workers() -> None:
|
||||||
host_address = "localhost:50052"
|
host_address = "localhost:50052"
|
||||||
@ -79,6 +81,7 @@ async def test_agent_types_must_be_unique_multiple_workers() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_register_receives_publish() -> None:
|
async def test_register_receives_publish() -> None:
|
||||||
host_address = "localhost:50053"
|
host_address = "localhost:50053"
|
||||||
@ -124,6 +127,7 @@ async def test_register_receives_publish() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_register_receives_publish_cascade_single_worker() -> None:
|
async def test_register_receives_publish_cascade_single_worker() -> None:
|
||||||
host_address = "localhost:50054"
|
host_address = "localhost:50054"
|
||||||
@ -159,6 +163,7 @@ async def test_register_receives_publish_cascade_single_worker() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.skip(reason="Fix flakiness")
|
@pytest.mark.skip(reason="Fix flakiness")
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_register_receives_publish_cascade_multiple_workers() -> None:
|
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()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_default_subscription() -> None:
|
async def test_default_subscription() -> None:
|
||||||
host_address = "localhost:50056"
|
host_address = "localhost:50056"
|
||||||
@ -238,6 +244,7 @@ async def test_default_subscription() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_default_subscription_other_source() -> None:
|
async def test_default_subscription_other_source() -> None:
|
||||||
host_address = "localhost:50057"
|
host_address = "localhost:50057"
|
||||||
@ -272,6 +279,7 @@ async def test_default_subscription_other_source() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_type_subscription() -> None:
|
async def test_type_subscription() -> None:
|
||||||
host_address = "localhost:50058"
|
host_address = "localhost:50058"
|
||||||
@ -309,6 +317,7 @@ async def test_type_subscription() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_duplicate_subscription() -> None:
|
async def test_duplicate_subscription() -> None:
|
||||||
host_address = "localhost:50059"
|
host_address = "localhost:50059"
|
||||||
@ -340,6 +349,7 @@ async def test_duplicate_subscription() -> None:
|
|||||||
await host.stop()
|
await host.stop()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_disconnected_agent() -> None:
|
async def test_disconnected_agent() -> None:
|
||||||
host_address = "localhost:50060"
|
host_address = "localhost:50060"
|
||||||
@ -418,6 +428,7 @@ class ProtoReceivingAgent(RoutedAgent):
|
|||||||
self.received_messages.append(message)
|
self.received_messages.append(message)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_proto_payloads() -> None:
|
async def test_proto_payloads() -> None:
|
||||||
host_address = "localhost:50057"
|
host_address = "localhost:50057"
|
||||||
@ -461,6 +472,7 @@ async def test_proto_payloads() -> None:
|
|||||||
# TODO add tests for failure to deserialize
|
# TODO add tests for failure to deserialize
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.grpc
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_grpc_max_message_size() -> None:
|
async def test_grpc_max_message_size() -> None:
|
||||||
default_max_size = 2**22
|
default_max_size = 2**22
|
||||||
|
Loading…
x
Reference in New Issue
Block a user