You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(azurite): Enhance connection string generation for network and local access (#859)
**Resolves#851**
This Pull Request enhances the `AzuriteContainer` to provide more
flexible and robust connection strings, specifically enabling seamless
communication between Azurite and other containers within the same
Docker network. It also clarifies access from the local host, addressing
the need for distinct connection types in containerized testing
environments.
---
### Key Changes
* **Introduces `ConnectionStringType` enum:** This new enum allows
specifying the intended access pattern when requesting an Azurite
connection string:
* `NETWORK`: Optimized for inter-container communication, leveraging
Docker network aliases for direct connectivity.
* `LOCALHOST`: Designed for access from the host machine, utilizing
dynamically exposed ports and the Docker host IP.
* **Refactored `get_connection_string`:** The main method now dispatches
to the appropriate internal function based on the `ConnectionStringType`
provided.
* **Improved `get_external_connection_string`:** This method has been
enhanced to intelligently prioritize network aliases for inter-container
communication and provide a robust fallback to the Docker host IP for
other scenarios.
* **Comprehensive Unit Test:** A new test case,
`test_azurite_inter_container_communication_with_network_string`, has
been added to thoroughly validate both network-based and local
host-based connection string functionality.
* **Enhanced Docstrings:** All relevant methods within
`AzuriteContainer` and the associated example application
(`network_container.py`) have received updated and more detailed
docstrings for improved clarity and usage guidance.
---
### Testing
To validate these functionalities, the new test case
`test_azurite_inter_container_communication_with_network_string` was
introduced. This test specifically verifies:
* **Inter-container communication:** An external application container
successfully connects to Azurite using the `NETWORK` connection string
(via its network alias) and performs an operation (e.g., creates a blob
container).
* **Local host access verification:** The operation performed by the
external container is then successfully verified from the local test
machine using the `LOCALHOST` connection string, confirming data
persistence and accessibility.
---
### Concerns and Questions
As this is my first contribution to this repository, I've aimed for
comprehensive docstrings and clear code. I'm open to feedback on their
level of detail, adherence to project conventions, or any other aspect
of the implementation.
Please let me know if any further changes or clarifications are needed.
0 commit comments