GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(azurite): Enhance connection string generation for network and local access by adendek · Pull Request #859 · testcontainers/testcontainers-python

Conversation

@adendek

@adendek adendek commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adendek
feat(azurite): Enable robust inter-container communication
146b618
Add functionality to generate Azurite connection strings suitable for direct container-to-container communication within a Docker network, alongside existing local host access.

Key changes include:
- Introduces `ConnectionStringType` enum to provide distinct Azurite
connection strings for different access patterns:
   - `NETWORK`: Optimized for inter-container communication using network aliases.
   - `LOCALHOST`: For access from the host machine via exposed ports.
- Refactored `get_connection_string` to dispatch based on `ConnectionStringType`.
- Improved `get_external_connection_string` to prioritize network aliases nd provide a fallback to host IP.
- Added comprehensive unit test (`test_azurite_inter_container_communication_with_network_string`)
  to verify inter-container connectivity.
@adendek adendek mentioned this pull request Aug 11, 2025
Question: Communication between azurite container and custom one #851
Closed
alexanderankin
alexanderankin reviewed Aug 11, 2025
View reviewed changes
Comment thread modules/azurite/testcontainers/azurite/__init__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@adendek
Replace match statement with if-else chain for compatibility with Pyt…
72bb4fc
…hon 3.9 in CI checks
@codecov

codecov Bot commented Aug 11, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@fc4155e). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #859   +/-   ##
=======================================
  Coverage        ?   81.83%           
=======================================
  Files           ?       14           
  Lines           ?      892           
  Branches        ?      140           
=======================================
  Hits            ?      730           
  Misses          ?      127           
  Partials        ?       35           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@adendek
adendek requested a review from alexanderankin August 12, 2025 09:23
@adendek

adendek commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

Can someone take a look at this PR? Do you want me to update it, or it is good to be merged?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexanderankin
alexanderankin force-pushed the main branch from 0b98419 to 72bb4fc Compare August 25, 2025 17:26
@alexanderankin

alexanderankin commented Aug 25, 2025

Copy link
Copy Markdown
Member

just rebased

adendek reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alexanderankin
alexanderankin approved these changes Aug 25, 2025
View reviewed changes
@alexanderankin
alexanderankin merged commit b21e5e3 into testcontainers:main Aug 25, 2025
@github-actions github-actions Bot mentioned this pull request Aug 20, 2025
chore(main): release testcontainers 4.13.0 #858
Merged
alexanderankin pushed a commit that referenced this pull request Sep 9, 2025
@github-actions
chore(main): release testcontainers 4.13.0 (#858)
504957b
🤖 I have created a release *beep* *boop*
---


##
[4.13.0](testcontainers-v4.12.0...testcontainers-v4.13.0)
(2025-08-27)


### Features

* **azurite:** Enhance connection string generation for network and
local access
([#859](#859))
([b21e5e3](b21e5e3))
* **core:** add enhanced wait strategies
([#855](#855))
([60d21f8](60d21f8))
* **core:** DockerCompose: support list of env_files
([#847](#847))
([fe206eb](fe206eb))


### Bug Fixes

* assert-in-get_container_host_ip-before-start
([#862](#862))
([fc4155e](fc4155e))
* **core:** improper reading of .testcontainers.properties
([#863](#863))
([350f246](350f246))
* **core:** Make TC_POOLING_INTERVAL/sleep_time a float
([#839](#839))
([a072f3f](a072f3f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alexanderankin alexanderankin alexanderankin approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Question: Communication between azurite container and custom one

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@adendek @alexanderankin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.