From 2af7ca74a640631e6b14400a7693c8f8407108ae Mon Sep 17 00:00:00 2001 From: luky116 Date: Tue, 30 Apr 2024 16:39:37 +0800 Subject: [PATCH 1/3] fix start testcontainers fail bug --- common/testcontainers/testcontainers.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/testcontainers/testcontainers.go b/common/testcontainers/testcontainers.go index 83da6af599..d3599997a5 100644 --- a/common/testcontainers/testcontainers.go +++ b/common/testcontainers/testcontainers.go @@ -31,6 +31,9 @@ type TestcontainerApps struct { // NewTestcontainerApps returns new instance of TestcontainerApps struct func NewTestcontainerApps() *TestcontainerApps { timestamp := time.Now().Nanosecond() + // In order to solve the problem of "creating reaper failed: failed to create container" + // refer to https://github.com/testcontainers/testcontainers-go/issues/2172 + os.Setenv("TESTCONTAINERS_RYUK_DISABLED", "true") return &TestcontainerApps{ Timestamp: timestamp, } From 3e3c76b74192e4131663ef5251b159c5bcef9269 Mon Sep 17 00:00:00 2001 From: luky116 Date: Tue, 30 Apr 2024 17:32:57 +0800 Subject: [PATCH 2/3] handler error --- common/testcontainers/testcontainers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/testcontainers/testcontainers.go b/common/testcontainers/testcontainers.go index d3599997a5..ab9918049b 100644 --- a/common/testcontainers/testcontainers.go +++ b/common/testcontainers/testcontainers.go @@ -33,7 +33,10 @@ func NewTestcontainerApps() *TestcontainerApps { timestamp := time.Now().Nanosecond() // In order to solve the problem of "creating reaper failed: failed to create container" // refer to https://github.com/testcontainers/testcontainers-go/issues/2172 - os.Setenv("TESTCONTAINERS_RYUK_DISABLED", "true") + err := os.Setenv("TESTCONTAINERS_RYUK_DISABLED", "true") + if err != nil { + panic("set env failed: " + err.Error()) + } return &TestcontainerApps{ Timestamp: timestamp, } From 6f84348feb56b33a511c4e9793f84322ef9b9107 Mon Sep 17 00:00:00 2001 From: luky116 Date: Tue, 30 Apr 2024 17:33:49 +0800 Subject: [PATCH 3/3] handler error --- common/testcontainers/testcontainers.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/testcontainers/testcontainers.go b/common/testcontainers/testcontainers.go index ab9918049b..327354d1f3 100644 --- a/common/testcontainers/testcontainers.go +++ b/common/testcontainers/testcontainers.go @@ -33,8 +33,7 @@ func NewTestcontainerApps() *TestcontainerApps { timestamp := time.Now().Nanosecond() // In order to solve the problem of "creating reaper failed: failed to create container" // refer to https://github.com/testcontainers/testcontainers-go/issues/2172 - err := os.Setenv("TESTCONTAINERS_RYUK_DISABLED", "true") - if err != nil { + if err := os.Setenv("TESTCONTAINERS_RYUK_DISABLED", "true"); err != nil { panic("set env failed: " + err.Error()) } return &TestcontainerApps{