Support for dynamic port for WaitForHttp.php #42
Merged
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.
This pull request introduces changes to improve container startup reliability and enhance the HTTP wait strategy in the codebase. Key updates include adding a delay to ensure containers are fully started, making the HTTP wait strategy more robust by handling dynamic port resolution and exceptions, and minor adjustments to improve code clarity.
Container Startup Reliability:
getBoundPortsmethod ofStartedGenericContainerto address potential issues with containers not being fully started in recent Docker releases. A TODO comment suggests finding a better long-term solution. (src/Container/StartedGenericContainer.php, src/Container/StartedGenericContainer.phpR201-R207)HTTP Wait Strategy Enhancements:
WaitForHttpclass to allow theportparameter to be nullable, enabling dynamic port resolution. (src/Wait/WaitForHttp.php, src/Wait/WaitForHttp.phpL34-R34)resolvePortmethod inWaitForHttpto dynamically determine the port if not explicitly provided. This method is invoked in thewaitmethod. (src/Wait/WaitForHttp.php, [1] [2]waitmethod to gracefully retry on port resolution or HTTP request failures until the timeout is reached. (src/Wait/WaitForHttp.php, src/Wait/WaitForHttp.phpR113-R115)Minor Improvements:
makeHttpRequestmethod for consistency and clarity. (src/Wait/WaitForHttp.php, src/Wait/WaitForHttp.phpL123-R128)