Skip to content

chore!: migrate to moby modules#3591

Merged
mdelapenya merged 26 commits intotestcontainers:mainfrom
thaJeztah:migrate_moby
Apr 3, 2026
Merged

chore!: migrate to moby modules#3591
mdelapenya merged 26 commits intotestcontainers:mainfrom
thaJeztah:migrate_moby

Conversation

@thaJeztah
Copy link
Copy Markdown
Contributor

@thaJeztah thaJeztah commented Mar 10, 2026

What does this PR do?

Migrate the Docker client dependency from the deprecated github.com/docker/docker (v28, incompatible) to the new github.com/moby/moby modular packages (github.com/moby/moby/api + github.com/moby/moby/client). This is a breaking change — several public API types and method signatures change.

Breaking changes to the Testcontainers API

Container interface

Method Old New
PortEndpoint PortEndpoint(ctx, port nat.Port, proto string) PortEndpoint(ctx, port string, proto string)
MappedPort MappedPort(ctx, nat.Port) (nat.Port, error) MappedPort(ctx, string) (network.Port, error)
Ports Ports(ctx) (nat.PortMap, error) Ports(ctx) (network.PortMap, error)
LivenessCheckPorts returns nat.PortSet returns network.PortSet

ImageBuildInfo interface & FromDockerfile struct

Old New
BuildOptions() returns build.ImageBuildOptions returns client.ImageBuildOptions
BuildOptionsModifier func(*build.ImageBuildOptions) func(*client.ImageBuildOptions)

DockerClient methods

Method Old New
Info Info(ctx) (system.Info, error) Info(ctx, client.InfoOptions) (client.SystemInfoResult, error)
Ping Ping(ctx) (types.Ping, error) Ping(ctx, client.PingOptions) (client.PingResult, error)
Events returns (<-chan Message, <-chan error) returns client.EventsResult
DiskUsage (types.DiskUsageOptions) (types.DiskUsage, error) (client.DiskUsageOptions) (client.DiskUsageResult, error)
RegistryLogin (auth registry.AuthConfig) (registry.AuthenticateOKBody, error) (client.RegistryLoginOptions) (client.RegistryLoginResult, error)

Type replacements

Old (docker/docker + docker/go-connections) New (moby/moby)
nat.Port (string) network.Port (struct) or plain string in method args
nat.PortMap network.PortMap
nat.PortSet network.PortSet
nat.PortBinding network.PortBinding (.HostIP is netip.Addr, not string)
build.ImageBuildOptions client.ImageBuildOptions

Other changes

  • Fix inverted port condition in HTTP wait strategy
  • Fix MergeCustomLabels to validate all keys before merging (eliminates flaky test)
  • Fix mergePortBindings to preserve user-defined HostIP/HostPort from HostConfigModifier
  • Protect DockerContainer.isRunning with atomic.Bool to prevent data races
  • Retry network removal on active endpoints race (nebulagraph)
  • Restore stdcopy multiplexing for ollama local process
  • Skip host network tests on colima (not just Docker Desktop)
  • All 66 modules updated with new go.mod / go.sum

Why is it important?

The github.com/docker/docker module has been deprecated in favor of the properly-versioned github.com/moby/moby modular packages. The new packages provide:

  • Proper Go module versioning (no more +incompatible)
  • Structured port types (network.Port) instead of string-based nat.Port, catching errors at compile time
  • netip.Addr for host IPs instead of raw strings
  • Cleaner API surfaces with result wrapper types

Staying on the deprecated module blocks upgrading to newer Docker Engine APIs and accumulates tech debt as the ecosystem moves to the moby packages.

Related issues

How to test this PR

  1. Run the core test suite: go test -race ./...
  2. Run module tests (each module has its own test suite requiring Docker)
  3. Verify make lint-all passes across all 66 modules
  4. Key tests to validate the migration:
    • TestTwoContainersExposingTheSamePort, TestContainerCreation, TestContainerCreationWithName — port handling
    • TestPreCreateModifierHook — port binding merge behavior
    • TestDockerProvider_waitContainerCreation_retries — container list result type
    • TestGenericReusableContainerInSubprocess — container list .Items usage
    • TestUDPPortBinding — port type changes

Follow-ups

  • Blocking merge: TestContainerTerminationResetsState and Test_MultiContainerLogConsumer_CancelledContext fail consistently with -race due to a data race upstream in moby/moby/client (cancelReadCloser in utils.go:139,152). The cancelReadCloser struct has an unsynchronized field written during construction and read during the cancel callback's Close(), triggered via ContainerLogs(). This needs a fix in the moby/moby/client package before this PR can merge with -race enabled.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 10, 2026

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit bb76dfe
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-go/deploys/69cd449e9099e1000866fd4a
😎 Deploy Preview https://deploy-preview-3591--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

Important

Review skipped

Too many files!

This PR contains 173 files, which is 23 over the limit of 150.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ff05e5f-adc1-4f03-bd30-001b4fa22e9f

📥 Commits

Reviewing files that changed from the base of the PR and between 1340c85 and bb76dfe.

⛔ Files ignored due to path filters (66)
  • examples/nginx/go.sum is excluded by !**/*.sum
  • go.sum is excluded by !**/*.sum
  • modules/aerospike/go.sum is excluded by !**/*.sum
  • modules/arangodb/go.sum is excluded by !**/*.sum
  • modules/artemis/go.sum is excluded by !**/*.sum
  • modules/azure/go.sum is excluded by !**/*.sum
  • modules/azurite/go.sum is excluded by !**/*.sum
  • modules/cassandra/go.sum is excluded by !**/*.sum
  • modules/chroma/go.sum is excluded by !**/*.sum
  • modules/clickhouse/go.sum is excluded by !**/*.sum
  • modules/cockroachdb/go.sum is excluded by !**/*.sum
  • modules/compose/go.sum is excluded by !**/*.sum
  • modules/consul/go.sum is excluded by !**/*.sum
  • modules/couchbase/go.sum is excluded by !**/*.sum
  • modules/databend/go.sum is excluded by !**/*.sum
  • modules/dind/go.sum is excluded by !**/*.sum
  • modules/dockermcpgateway/go.sum is excluded by !**/*.sum
  • modules/dockermodelrunner/go.sum is excluded by !**/*.sum
  • modules/dolt/go.sum is excluded by !**/*.sum
  • modules/dynamodb/go.sum is excluded by !**/*.sum
  • modules/elasticsearch/go.sum is excluded by !**/*.sum
  • modules/etcd/go.sum is excluded by !**/*.sum
  • modules/forgejo/go.sum is excluded by !**/*.sum
  • modules/gcloud/go.sum is excluded by !**/*.sum
  • modules/grafana-lgtm/go.sum is excluded by !**/*.sum
  • modules/inbucket/go.sum is excluded by !**/*.sum
  • modules/influxdb/go.sum is excluded by !**/*.sum
  • modules/k3s/go.sum is excluded by !**/*.sum
  • modules/k6/go.sum is excluded by !**/*.sum
  • modules/kafka/go.sum is excluded by !**/*.sum
  • modules/localstack/go.sum is excluded by !**/*.sum
  • modules/mariadb/go.sum is excluded by !**/*.sum
  • modules/meilisearch/go.sum is excluded by !**/*.sum
  • modules/memcached/go.sum is excluded by !**/*.sum
  • modules/milvus/go.sum is excluded by !**/*.sum
  • modules/minio/go.sum is excluded by !**/*.sum
  • modules/mockserver/go.sum is excluded by !**/*.sum
  • modules/mongodb/go.sum is excluded by !**/*.sum
  • modules/mssql/go.sum is excluded by !**/*.sum
  • modules/mysql/go.sum is excluded by !**/*.sum
  • modules/nats/go.sum is excluded by !**/*.sum
  • modules/nebulagraph/go.sum is excluded by !**/*.sum
  • modules/neo4j/go.sum is excluded by !**/*.sum
  • modules/ollama/go.sum is excluded by !**/*.sum
  • modules/openfga/go.sum is excluded by !**/*.sum
  • modules/openldap/go.sum is excluded by !**/*.sum
  • modules/opensearch/go.sum is excluded by !**/*.sum
  • modules/pinecone/go.sum is excluded by !**/*.sum
  • modules/postgres/go.sum is excluded by !**/*.sum
  • modules/pulsar/go.sum is excluded by !**/*.sum
  • modules/qdrant/go.sum is excluded by !**/*.sum
  • modules/rabbitmq/go.sum is excluded by !**/*.sum
  • modules/redis/go.sum is excluded by !**/*.sum
  • modules/redpanda/go.sum is excluded by !**/*.sum
  • modules/registry/go.sum is excluded by !**/*.sum
  • modules/scylladb/go.sum is excluded by !**/*.sum
  • modules/socat/go.sum is excluded by !**/*.sum
  • modules/solace/go.sum is excluded by !**/*.sum
  • modules/surrealdb/go.sum is excluded by !**/*.sum
  • modules/tidb/go.sum is excluded by !**/*.sum
  • modules/toxiproxy/go.sum is excluded by !**/*.sum
  • modules/valkey/go.sum is excluded by !**/*.sum
  • modules/vault/go.sum is excluded by !**/*.sum
  • modules/vearch/go.sum is excluded by !**/*.sum
  • modules/weaviate/go.sum is excluded by !**/*.sum
  • modules/yugabytedb/go.sum is excluded by !**/*.sum
📒 Files selected for processing (173)
  • .golangci.yml
  • cleanup.go
  • commons-test.mk
  • container.go
  • container_test.go
  • docker.go
  • docker_auth.go
  • docker_auth_test.go
  • docker_client.go
  • docker_client_test.go
  • docker_exec_test.go
  • docker_mounts.go
  • docker_test.go
  • examples/nginx/go.mod
  • examples_test.go
  • exec/processor.go
  • from_dockerfile_test.go
  • generate.go
  • generic_test.go
  • go.mod
  • image.go
  • internal/core/client.go
  • internal/core/docker_host.go
  • internal/core/docker_host_test.go
  • internal/core/docker_socket.go
  • internal/core/labels.go
  • internal/core/labels_test.go
  • internal/core/network/network.go
  • lifecycle.go
  • lifecycle_test.go
  • logconsumer_test.go
  • modules/aerospike/examples_test.go
  • modules/aerospike/go.mod
  • modules/arangodb/go.mod
  • modules/artemis/artemis.go
  • modules/artemis/go.mod
  • modules/azure/azurite/azurite.go
  • modules/azure/cosmosdb/cosmosdb.go
  • modules/azure/go.mod
  • modules/azure/lowkeyvault/lowkeyvault.go
  • modules/azurite/go.mod
  • modules/cassandra/go.mod
  • modules/chroma/go.mod
  • modules/clickhouse/clickhouse.go
  • modules/clickhouse/clickhouse_test.go
  • modules/clickhouse/go.mod
  • modules/cockroachdb/cockroachdb.go
  • modules/cockroachdb/go.mod
  • modules/compose/compose_api.go
  • modules/compose/compose_api_test.go
  • modules/compose/compose_local.go
  • modules/compose/compose_test.go
  • modules/compose/go.mod
  • modules/consul/go.mod
  • modules/couchbase/couchbase.go
  • modules/couchbase/go.mod
  • modules/databend/go.mod
  • modules/dind/dind.go
  • modules/dind/dind_test.go
  • modules/dind/examples_test.go
  • modules/dind/go.mod
  • modules/dockermcpgateway/dockermcpgateway.go
  • modules/dockermcpgateway/go.mod
  • modules/dockermodelrunner/docker_desktop_test.go
  • modules/dockermodelrunner/go.mod
  • modules/dolt/dolt.go
  • modules/dolt/go.mod
  • modules/dynamodb/go.mod
  • modules/elasticsearch/go.mod
  • modules/etcd/etcd_unit_test.go
  • modules/etcd/go.mod
  • modules/forgejo/go.mod
  • modules/gcloud/gcloud.go
  • modules/gcloud/go.mod
  • modules/grafana-lgtm/go.mod
  • modules/inbucket/go.mod
  • modules/influxdb/go.mod
  • modules/k3s/go.mod
  • modules/k3s/k3s.go
  • modules/k6/go.mod
  • modules/k6/k6.go
  • modules/k6/k6_test.go
  • modules/kafka/go.mod
  • modules/kafka/kafka.go
  • modules/localstack/go.mod
  • modules/localstack/localstack.go
  • modules/localstack/v1/s3_test.go
  • modules/localstack/v2/s3_test.go
  • modules/mariadb/go.mod
  • modules/meilisearch/go.mod
  • modules/memcached/go.mod
  • modules/milvus/go.mod
  • modules/minio/go.mod
  • modules/mockserver/go.mod
  • modules/mongodb/go.mod
  • modules/mssql/go.mod
  • modules/mysql/go.mod
  • modules/nats/go.mod
  • modules/nebulagraph/go.mod
  • modules/nebulagraph/nebulagraph.go
  • modules/neo4j/go.mod
  • modules/neo4j/neo4j.go
  • modules/neo4j/neo4j_test.go
  • modules/ollama/examples_test.go
  • modules/ollama/go.mod
  • modules/ollama/local.go
  • modules/ollama/local_test.go
  • modules/ollama/ollama.go
  • modules/ollama/options.go
  • modules/openfga/go.mod
  • modules/openldap/go.mod
  • modules/opensearch/go.mod
  • modules/opensearch/opensearch.go
  • modules/pinecone/go.mod
  • modules/postgres/go.mod
  • modules/postgres/postgres_test.go
  • modules/pulsar/go.mod
  • modules/pulsar/pulsar.go
  • modules/pulsar/pulsar_test.go
  • modules/qdrant/go.mod
  • modules/rabbitmq/go.mod
  • modules/rabbitmq/rabbitmq.go
  • modules/redis/go.mod
  • modules/redpanda/go.mod
  • modules/redpanda/redpanda.go
  • modules/registry/go.mod
  • modules/registry/registry.go
  • modules/registry/registry_test.go
  • modules/scylladb/go.mod
  • modules/socat/go.mod
  • modules/socat/socat.go
  • modules/solace/go.mod
  • modules/solace/solace.go
  • modules/surrealdb/go.mod
  • modules/tidb/go.mod
  • modules/toxiproxy/go.mod
  • modules/toxiproxy/toxiproxy.go
  • modules/valkey/go.mod
  • modules/vault/go.mod
  • modules/vault/vault.go
  • modules/vearch/go.mod
  • modules/vearch/vearch.go
  • modules/weaviate/go.mod
  • modules/yugabytedb/go.mod
  • mounts_test.go
  • network.go
  • network/examples_test.go
  • network/network.go
  • network/network_test.go
  • options.go
  • options_test.go
  • port_forwarding.go
  • reaper.go
  • reaper_test.go
  • reuse_test.go
  • testing.go
  • udp_port_binding_test.go
  • wait/exec_test.go
  • wait/exit_test.go
  • wait/file_test.go
  • wait/health.go
  • wait/health_test.go
  • wait/host_port.go
  • wait/host_port_test.go
  • wait/http.go
  • wait/http_test.go
  • wait/log_test.go
  • wait/nop.go
  • wait/sql.go
  • wait/sql_test.go
  • wait/strategytarget_mock_test.go
  • wait/wait.go
  • wait/wait_test.go

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thaJeztah thaJeztah changed the title migrate to moby modules chore!: migrate to moby modules Mar 10, 2026
@thaJeztah thaJeztah force-pushed the migrate_moby branch 9 times, most recently from 0b5bb52 to 15c2930 Compare March 11, 2026 01:04
@aausch
Copy link
Copy Markdown
Contributor

aausch commented Mar 30, 2026

@thaJeztah I had some extra cycles so went through as many of the outstanding issues as I could and tried to fix them.

Hoping to help accelerate this migration.

Each change should be in a self-contained commit just in case I got them wrong, to make it easy to review, cherry-pick, discard, etc.

Comment thread udp_port_binding_test.go Outdated
portNum := mappedPort.Num()
assert.Positive(t, portNum, "Port number should be greater than 0")
assert.LessOrEqual(t, portNum, 65535, "Port number should be valid UDP port range")
assert.LessOrEqual(t, portNum, uint16(65535), "Port number should be valid UDP port range")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This assert can probably be dropped overall; it'd be extremely unlikely for a uint16 to be larger than 65535 😂

Comment thread modules/chroma/go.mod
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
mdelapenya and others added 9 commits April 1, 2026 18:15
Tests that create nginx containers exposing port 80 were incorrectly
querying port 8080 via PortEndpoint, causing "port 8080/tcp not found".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The mock ContainerList returned an empty Items slice on success, causing
findContainerByName to return nil and trigger unexpected retries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… bindings

mergePortBindings now correctly preserves user-defined HostIP and
HostPort from HostConfigModifier instead of discarding them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ContainerList now returns a struct, not a slice — use .Items for len().
Port.Num() returns uint16, not int — match type in assertion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The isRunning field was a plain bool read/written from multiple
goroutines without synchronization. Use atomic.Bool to eliminate
the data race detected by -race in TestContainerTerminationResetsState
and Test_MultiContainerLogConsumer_CancelledContext.

Note: a remaining race in TestContainerTerminationResetsState is
upstream in moby/client cancelReadCloser, not in testcontainers-go.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@aausch
Copy link
Copy Markdown
Contributor

aausch commented Apr 2, 2026

preemtive 🥂

@mdelapenya mdelapenya marked this pull request as ready for review April 3, 2026 07:24
@mdelapenya mdelapenya requested a review from a team as a code owner April 3, 2026 07:24
@mdelapenya mdelapenya added the breaking change Causing compatibility issues. label Apr 3, 2026
@mdelapenya mdelapenya self-assigned this Apr 3, 2026
Copy link
Copy Markdown
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, I marked this as a breaking changes for the release notes, so that we include the migration path for the changed APIs

Thanks everybody participating in this, specially @aausch and @appleboy

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb76dfedf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/ollama/local.go
Comment on lines +470 to +474
if c.host == "localhost" {
cIP = netip.MustParseAddr("127.0.0.1").Unmap()
}
if c.host != "" {
cIP, err = netip.ParseAddr(c.host)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Skip parsing localhost as a numeric IP

When c.host is "localhost", this code first maps it to 127.0.0.1 and then immediately reparses c.host with netip.ParseAddr, which fails for the hostname localhost. That makes Inspect() return an error for localhost-bound local Ollama runs, and any feature depending on Inspect (e.g., wait strategies or Ports) will fail even though the process is healthy.

Useful? React with 👍 / 👎.

Comment thread wait/http.go
Comment on lines +82 to +83
if p, err := network.ParsePort(port); err == nil {
ws.Port = p
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail fast on invalid HTTP wait port strings

This silently ignores parse failures and leaves ws.Port at zero, which WaitUntilReady treats as "use the lowest exposed port". A typo in WithPort(...) (for example an invalid protocol suffix) can therefore probe the wrong port and report readiness for an unintended endpoint instead of surfacing a configuration error.

Useful? React with 👍 / 👎.

@mdelapenya mdelapenya merged commit 3e56fb9 into testcontainers:main Apr 3, 2026
222 checks passed
mdelapenya added a commit that referenced this pull request Apr 3, 2026
* origin/main:
  chore(deps): bump github.com/moby/patternmatcher from 0.6.0 to 0.6.1 (#3628)
  chore(deps): bump github.com/shirou/gopsutil/v4 from 4.26.2 to 4.26.3 (#3627)
  chore: strip Gas Town overlay from CLAUDE.md (gt-p35)
  chore: add project instructions
  fix: auto-save uncommitted implementation work (gt-pvx safety net)
  fix(localstack): accept community-archive as a valid tag (#3601)
  chore!: migrate to moby modules (#3591)
  chore(deps): bump github.com/go-jose/go-jose/v4 in /modules/gcloud (#3632)
  chore(deps): bump actions/upload-artifact from 6.0.0 to 7.0.0 (#3625)
  fix(usage-metrics): include last release in the legend pop over (#3630)
  chore: update usage metrics (2026-04) (#3621)
@appleboy
Copy link
Copy Markdown
Contributor

appleboy commented Apr 5, 2026

@mdelapenya Waiting for next version. Thanks all.

ponimas pushed a commit to zalando/skipper that referenced this pull request Apr 13, 2026
- testcontainers-go depends on docker/docker
- eopa depends on docker/docker

Both depend only in tests/examples on docker/docker , so CVE is not a
vulnerability in skipper binary.

testcontainers-go was fixed
testcontainers/testcontainers-go#3591
eopa we are working on a fix
open-policy-agent/eopa#370

---------

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Comment thread wait/sql.go
@@ -111,7 +114,7 @@ func (w *waitForSQL) WaitUntilReady(ctx context.Context, target StrategyTarget)
}
}

db, err := sql.Open(w.Driver, w.URL(host, port))
db, err := sql.Open(w.Driver, w.URL(host, port.String()))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi! I have a question about this change because my team is using the wait.ForSQL strategy.

Before, when port was nat.Port we could get the port number using port.Port() but now port.String() includes the protocol which means we have to parse the port ourselves. Does it make sense to either

  1. Change the port type in the callback to network.Port
    or
  2. Instead use port.Port() here to only pass the port number and exclude the protocol?

Thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh! Hm.. good question; I do recall that originally I changed some signatures to be more strongly typed (i.e., require network.Port as argument), but the number of places where a plain string was passed in, and now requiring to either use a network.MustParsePort or network.ParsePort was ... quite large, so I went back and made it loosely typed on the way in (and parse internally).

However this part is a callback, so the user isn't bothered by having to do the conversion, so perhaps we should change the signature to accept a network.Port as type here; while I expect most cases the port to be a TCP port, theoretically it could be a different protocol; I see there's at least a couple of tests passing in a port with a protocol; so passing ONLY the .Port() would mean we'd lose that information

func Test_waitForSql_WithQuery(t *testing.T) {
t.Run("default query", func(t *testing.T) {
w := ForSQL("5432/tcp", "postgres", func(_ string, _ string) string {
return "fake-url"
})

So perhaps changing it to a network.Port instead of a string would be best? That way the callback function wouldn't need to parse the port (again), and no information would be lost. Code that depended on nat.Port being a string (with extras) may need to be updated (either use port.String() or port.Port() depending on what's needed), but ... probably acceptable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey! Thanks for the quick response and PR!

Changing the type to network.Port makes sense to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Causing compatibility issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants