Skip to content

Conversation

@mbrandenburger
Copy link
Member

@mbrandenburger mbrandenburger commented Nov 7, 2025

This PR refactors the postgres container code. In particular, it removes a consul sdk dep to pick a free port for the postgres instances we run within NWO and unit-tests. We let NWO select a free container port or let the container runtime select the port during unit-tests.

This PR contributes to #828 and #434

Overview:

  • let NWO select the ports for the postgres containers
  • in unit-tests, the container runtime selects the port
  • introduce options for postgres.DefaultConfig

Note

This PR changes the API of postgres.DefaultConfig, which is also used by the TokenSDK for testing.

@mbrandenburger mbrandenburger self-assigned this Nov 7, 2025
@mbrandenburger mbrandenburger added cleanup Something needs some cleanup dependencies Pull requests that update a dependency file testing All related to testing labels Nov 7, 2025
@mbrandenburger mbrandenburger added this to the 25Q4 milestone Nov 7, 2025
@mbrandenburger
Copy link
Member Author

mbrandenburger commented Nov 7, 2025

still WIP

@mbrandenburger mbrandenburger force-pushed the remove-freeport branch 6 times, most recently from a8a8f69 to 4ab0cef Compare November 18, 2025 10:50
Some postgres test uses a helper function from the consul sdk to get a
free network port to start a postgres container instance; to reduce
code dependencies, we let the container runtime to select a free port.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger mbrandenburger marked this pull request as ready for review November 18, 2025 12:27
@mbrandenburger mbrandenburger changed the title refactor: Remove consul sdk dep refactor!: Remove consul sdk dep Nov 18, 2025
@mbrandenburger
Copy link
Member Author

@AkramBitar this PR addresses the postgres issue you experienced in #1033. I've integrated your changes to gracefully shutdown a postgres container.

Copy link
Contributor

@SaidAltury-ibm SaidAltury-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is neat! great work LGTM

@mbrandenburger mbrandenburger merged commit 1c715d4 into hyperledger-labs:main Nov 18, 2025
22 checks passed
@mbrandenburger mbrandenburger deleted the remove-freeport branch November 18, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Something needs some cleanup dependencies Pull requests that update a dependency file testing All related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants