Skip to content

Question: Communication between azurite container and custom one #851

@adendek

Description

@adendek

What are you trying to do?

This question is a copy of the one posted on SO. You can answer here or use SO to get bounty.

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.
  • Engine sends status to the status queue
  • Engine saves artifacts to the blob storage.

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!

Runtime environment

I am using:

  • python 3.10,
  • testcontainers 4.12.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions