diff --git a/kafka_events/docker/Dockerfile b/kafka_events/docker/Dockerfile index e0d70d95e..5723dca0b 100644 --- a/kafka_events/docker/Dockerfile +++ b/kafka_events/docker/Dockerfile @@ -16,7 +16,8 @@ USER root RUN chown indy:indy -R . USER indy -RUN poetry install --no-dev --extras aca-py +ARG install_flags='--with integration --extras aca-py' +RUN poetry install ${install_flags} # Make site packages location more accessible (for use with volumes) RUN ln -s $(poetry env info -p)/lib/python3.6/site-packages site-packages diff --git a/kafka_events/integration/tests/conftest.py b/kafka_events/integration/tests/conftest.py index 44d6d7547..3dfebcf9a 100644 --- a/kafka_events/integration/tests/conftest.py +++ b/kafka_events/integration/tests/conftest.py @@ -7,7 +7,7 @@ from aiokafka.consumer.consumer import AIOKafkaConsumer from aiokafka.producer.producer import AIOKafkaProducer -import pytest +import pytest_asyncio from acapy_client import Client from acapy_client.api.connection import create_static, delete_connection, set_metadata @@ -20,7 +20,7 @@ from echo_agent import EchoClient -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def event_loop(): """Create a session scoped event loop. pytest.asyncio plugin provides a default function scoped event loop @@ -29,51 +29,51 @@ def event_loop(): return asyncio.get_event_loop() -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def host(): """Hostname of agent under test.""" return getenv("AGENT_HOST", "localhost") -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def port(): """Port of agent under test.""" return getenv("AGENT_PORT", 3000) -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def backchannel_port(): """Port of agent under test backchannel.""" return getenv("AGENT_BACKCHANNEL_PORT", 3001) -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def echo_endpoint(): return getenv("ECHO_ENDPOINT", "http://localhost:4000") -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def backchannel(host, backchannel_port): """Yield backchannel client.""" yield Client(base_url="http://{}:{}".format(host, backchannel_port)) -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def suite_seed(): yield hashlib.sha256(b"acapy-plugin-toolbox-int-test-runner").hexdigest()[:32] -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def agent_seed(): yield hashlib.sha256(b"acapy-plugin-toolbox-int-test-runner").hexdigest()[:32] -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def agent_endpoint(host, port): yield "http://{}:{}".format(host, port) -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def agent_connection( suite_seed, agent_seed, backchannel, echo_endpoint ) -> Iterator[ConnectionStaticResult]: @@ -112,28 +112,28 @@ def agent_connection( ) -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def conn_record(agent_connection: ConnectionStaticResult): yield agent_connection.record -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def connection_id(conn_record: ConnRecord): yield conn_record.connection_id -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") def echo_agent(echo_endpoint: str): yield EchoClient(base_url=echo_endpoint) -@pytest.fixture +@pytest_asyncio.fixture async def echo(echo_agent: EchoClient): async with echo_agent as client: yield client -@pytest.fixture(scope="session") +@pytest_asyncio.fixture(scope="session") async def connection( agent_connection: ConnectionStaticResult, echo_agent: EchoClient, suite_seed: str ): @@ -148,7 +148,7 @@ async def connection( yield conn -@pytest.fixture +@pytest_asyncio.fixture def consumer(): def _consumer(topic: str): return AIOKafkaConsumer(topic, bootstrap_servers="kafka", group_id="test") @@ -156,7 +156,7 @@ def _consumer(topic: str): yield _consumer -@pytest.fixture +@pytest_asyncio.fixture async def producer(): producer = AIOKafkaProducer(bootstrap_servers="kafka")