[Python] Unable to Connect to Azurite Container from Custom Engine Container in Integration...

Discussão em 'Python' iniciado por Stack, Julho 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently working on integration tests for my project, which consists of two main components: an application and an engine. Both components are deployed into Azure Container Apps. The engine scales using Azure Storage Queue. The workflow is as follows:

    The application sends a request to the Azure queue. The engine consumes the request and processes it. I'm facing difficulties in establishing a connection to the Azurite container from my custom engine container. Below is the test case I'm using:

    class TestEngine(BaseTestCase):

    def test_integration_engine(self):
    with Network() as network:
    logger.info(f"Network {network.name}")
    with AzuriteContainer() \
    .with_network(network) \
    .with_network_aliases("azurite_server") \
    .with_exposed_ports(10000, 10000) \
    .with_exposed_ports(10001, 10001) as azurite_container:
    connection_string = azurite_container.get_connection_string()

    with DockerContainer("57361aab4105730a7ff9d538e9bee44dfe9c24d57cc6e396edff7dbea2de5031") \
    .with_env("blob_connection_string", connection_string) \
    .with_network(network) \
    .with_network_aliases("engine_app") \
    .with_exposed_ports(80, 80) as container:
    logger.info("Waiting for logs from engine!")
    try:
    wait_for_logs(container, "Starting handling", timeout=60)
    logger.info("Engine processing started according to logs.")
    except Exception as e:
    logger.warning(f"Engine processing start logs not found within timeout: {e}")
    logger.warning("Collecting logs and continuing anyway.")
    # send_request_task(connection_string)

    print(collect_logs(container, 200))



    Note: The validation logic and docstrings have been omitted for brevity.

    However, the engine process (running on a custom container) is terminated with the following error message:

    raise error\nazure.core.exceptions.ServiceRequestError: <urllib3.connection.HTTPConnection object at 0x7fddad8b47c0>: Failed to establish a new connection: [Errno 111] Connection refused\n')]


    Could someone help me understand why the connection to the Azurite container is being refused and how I can resolve this issue? Any guidance or suggestions would be greatly appreciated!

    Continue reading...

Compartilhe esta Página