Skip to content

Commit

Permalink
remove: gotest.tools/v3 usage
Browse files Browse the repository at this point in the history
  • Loading branch information
hhsnopek committed Nov 8, 2022
1 parent 33213e1 commit f19472d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
16 changes: 8 additions & 8 deletions docker_test.go
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"log"
"path"

// Import mysql into the scope of this package (required)
"io"
Expand All @@ -26,7 +27,6 @@ import (
"github.com/go-redis/redis/v8"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/v3/fs"

"github.com/docker/docker/errdefs"

Expand Down Expand Up @@ -1481,17 +1481,17 @@ func TestReadTCPropsFile(t *testing.T) {
})

t.Run("HOME does not contain TC props file", func(t *testing.T) {
tmpDir := fs.NewDir(t, os.TempDir())
t.Setenv("HOME", tmpDir.Path())
tmpDir := t.TempDir()
t.Setenv("HOME", tmpDir)

config := configureTC()

assert.Empty(t, config, "TC props file should not exist")
})

t.Run("HOME does not contain TC props file - TESTCONTAINERS_ env is set", func(t *testing.T) {
tmpDir := fs.NewDir(t, os.TempDir())
t.Setenv("HOME", tmpDir.Path())
tmpDir := t.TempDir()
t.Setenv("HOME", tmpDir)
t.Setenv("TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED", "true")

config := configureTC()
Expand Down Expand Up @@ -1697,12 +1697,12 @@ func TestReadTCPropsFile(t *testing.T) {
}
for i, tt := range tests {
t.Run(fmt.Sprintf("[%d]", i), func(t *testing.T) {
tmpDir := fs.NewDir(t, os.TempDir())
t.Setenv("HOME", tmpDir.Path())
tmpDir := t.TempDir()
t.Setenv("HOME", tmpDir)
for k, v := range tt.env {
t.Setenv(k, v)
}
if err := os.WriteFile(tmpDir.Join(".testcontainers.properties"), []byte(tt.content), 0o600); err != nil {
if err := os.WriteFile(path.Join(tmpDir, ".testcontainers.properties"), []byte(tt.content), 0o600); err != nil {
t.Errorf("Failed to create the file: %v", err)
return
}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Expand Up @@ -22,7 +22,6 @@ require (
golang.org/x/sys v0.1.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/gotestsum v1.8.2
gotest.tools/v3 v3.4.0
)

replace (
Expand Down
1 change: 0 additions & 1 deletion go.sum
Expand Up @@ -1068,7 +1068,6 @@ gotest.tools/gotestsum v1.8.2/go.mod h1:6JHCiN6TEjA7Kaz23q1bH0e2Dc3YJjDUZ0DmctFZ
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.3.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A=
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
6 changes: 3 additions & 3 deletions logconsumer_test.go
Expand Up @@ -10,8 +10,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"

"github.com/docker/docker/client"

Expand Down Expand Up @@ -106,7 +106,7 @@ func Test_LogConsumerGetsCalled(t *testing.T) {
// get rid of the server "ready" log
g.Msgs = g.Msgs[1:]

assert.DeepEqual(t, []string{"echo hello\n", "echo there\n"}, g.Msgs)
assert.Equal(t, []string{"echo hello\n", "echo there\n"}, g.Msgs)
terminateContainerOnEnd(t, ctx, c)
}

Expand Down Expand Up @@ -181,7 +181,7 @@ func Test_ShouldRecognizeLogTypes(t *testing.T) {
<-g.Ack
_ = c.StopLogProducer()

assert.DeepEqual(t, map[string]string{
assert.Equal(t, map[string]string{
StdoutLog: "echo this-is-stdout\n",
StderrLog: "echo this-is-stderr\n",
}, g.LogTypes)
Expand Down
5 changes: 3 additions & 2 deletions wait/http_test.go
Expand Up @@ -11,6 +11,7 @@ import (
"net"
"net/http"
"os"
"path"
"testing"
"time"

Expand Down Expand Up @@ -51,7 +52,7 @@ func TestHTTPStrategyWaitUntilReady(t *testing.T) {
return
}

capath := workdir + "/testdata/root.pem"
capath := path.Join(workdir, "testdata", "root.pem")
cafile, err := os.ReadFile(capath)
if err != nil {
t.Errorf("can't load ca file: %v", err)
Expand All @@ -68,7 +69,7 @@ func TestHTTPStrategyWaitUntilReady(t *testing.T) {
var i int
dockerReq := testcontainers.ContainerRequest{
FromDockerfile: testcontainers.FromDockerfile{
Context: workdir + "/testdata",
Context: path.Join(workdir, "/testdata"),
},
ExposedPorts: []string{"6443/tcp"},
WaitingFor: wait.NewHTTPStrategy("/ping").WithTLS(true, tlsconfig).
Expand Down

0 comments on commit f19472d

Please sign in to comment.