From 6150f74d4b2ee75d27a7d57092a8fc18f76e439d Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 8 Mar 2024 11:31:35 +0800 Subject: [PATCH 1/2] fix: consul race on HTTP port Signed-off-by: Adrian Cole --- modules/consul/consul.go | 3 ++- modules/consul/examples_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/consul/consul.go b/modules/consul/consul.go index 08a6e0ece2..ff49341c3b 100644 --- a/modules/consul/consul.go +++ b/modules/consul/consul.go @@ -14,7 +14,7 @@ const ( ) const ( - DefaultBaseImage = "docker.io/hashicorp/consul:1.15" + DefaultBaseImage = "docker.io/hashicorp/consul:1.18" ) // ConsulContainer represents the Consul container type used in the module. @@ -70,6 +70,7 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize Env: map[string]string{}, WaitingFor: wait.ForAll( wait.ForLog("Consul agent running!"), + wait.ForListeningPort(defaultHttpApiPort+"/tcp"), ), }, Started: true, diff --git a/modules/consul/examples_test.go b/modules/consul/examples_test.go index 002c143c95..333a0cb03d 100644 --- a/modules/consul/examples_test.go +++ b/modules/consul/examples_test.go @@ -16,7 +16,7 @@ func ExampleRunContainer() { ctx := context.Background() consulContainer, err := consul.RunContainer(ctx, - testcontainers.WithImage("docker.io/hashicorp/consul:1.15"), + testcontainers.WithImage("docker.io/hashicorp/consul:1.18"), ) if err != nil { log.Fatalf("failed to start container: %s", err) @@ -46,7 +46,7 @@ func ExampleRunContainer_connect() { ctx := context.Background() consulContainer, err := consul.RunContainer(ctx, - testcontainers.WithImage("docker.io/hashicorp/consul:1.15"), + testcontainers.WithImage("docker.io/hashicorp/consul:1.18"), ) if err != nil { log.Fatalf("failed to start container: %s", err) From 341b5f0ad1e31c139435d9828c9c17bccac37a78 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 8 Mar 2024 14:41:52 +0800 Subject: [PATCH 2/2] revert image bump Signed-off-by: Adrian Cole --- modules/consul/consul.go | 2 +- modules/consul/examples_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/consul/consul.go b/modules/consul/consul.go index ff49341c3b..e4ec01fd02 100644 --- a/modules/consul/consul.go +++ b/modules/consul/consul.go @@ -14,7 +14,7 @@ const ( ) const ( - DefaultBaseImage = "docker.io/hashicorp/consul:1.18" + DefaultBaseImage = "docker.io/hashicorp/consul:1.15" ) // ConsulContainer represents the Consul container type used in the module. diff --git a/modules/consul/examples_test.go b/modules/consul/examples_test.go index 333a0cb03d..002c143c95 100644 --- a/modules/consul/examples_test.go +++ b/modules/consul/examples_test.go @@ -16,7 +16,7 @@ func ExampleRunContainer() { ctx := context.Background() consulContainer, err := consul.RunContainer(ctx, - testcontainers.WithImage("docker.io/hashicorp/consul:1.18"), + testcontainers.WithImage("docker.io/hashicorp/consul:1.15"), ) if err != nil { log.Fatalf("failed to start container: %s", err) @@ -46,7 +46,7 @@ func ExampleRunContainer_connect() { ctx := context.Background() consulContainer, err := consul.RunContainer(ctx, - testcontainers.WithImage("docker.io/hashicorp/consul:1.18"), + testcontainers.WithImage("docker.io/hashicorp/consul:1.15"), ) if err != nil { log.Fatalf("failed to start container: %s", err)