Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace 'assert' with 'require' for critical checks #2824

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions from_dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand All @@ -38,7 +37,7 @@ func TestBuildImageFromDockerfile(t *testing.T) {
// }
})
require.NoError(t, err)
assert.Equal(t, "test-repo:test-tag", tag)
require.Equal(t, "test-repo:test-tag", tag)

_, _, err = cli.ImageInspectWithRaw(ctx, tag)
require.NoError(t, err)
Expand Down Expand Up @@ -73,7 +72,7 @@ func TestBuildImageFromDockerfile_NoRepo(t *testing.T) {
},
})
require.NoError(t, err)
assert.True(t, strings.HasPrefix(tag, "test-repo:"))
require.True(t, strings.HasPrefix(tag, "test-repo:"))

_, _, err = cli.ImageInspectWithRaw(ctx, tag)
require.NoError(t, err)
Expand Down Expand Up @@ -130,7 +129,7 @@ func TestBuildImageFromDockerfile_NoTag(t *testing.T) {
},
})
require.NoError(t, err)
assert.True(t, strings.HasSuffix(tag, ":test-tag"))
require.True(t, strings.HasSuffix(tag, ":test-tag"))

_, _, err = cli.ImageInspectWithRaw(ctx, tag)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion modules/etcd/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestRun(t *testing.T) {

c, r, err := ctr.Exec(ctx, []string{"etcdctl", "member", "list"}, tcexec.Multiplexed())
require.NoError(t, err)
require.Equal(t, 0, c)
require.Zero(t, c)

output, err := io.ReadAll(r)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion modules/vault/vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestVault(t *testing.T) {
exec, reader, err := vaultContainer.Exec(ctx, []string{"vault", "kv", "get", "-format=json", "secret/test1"})
// }
require.NoError(t, err)
assert.Equal(t, 0, exec)
require.Zero(t, exec)

bytes, err := io.ReadAll(reader)
require.NoError(t, err)
Expand Down
8 changes: 4 additions & 4 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ func TestWithStartupCommand(t *testing.T) {
err := testcontainers.WithStartupCommand(testExec)(&req)
require.NoError(t, err)

assert.Len(t, req.LifecycleHooks, 1)
assert.Len(t, req.LifecycleHooks[0].PostStarts, 1)
require.Len(t, req.LifecycleHooks, 1)
require.Len(t, req.LifecycleHooks[0].PostStarts, 1)

c, err := testcontainers.GenericContainer(context.Background(), req)
testcontainers.CleanupContainer(t, c)
Expand Down Expand Up @@ -144,8 +144,8 @@ func TestWithAfterReadyCommand(t *testing.T) {
err := testcontainers.WithAfterReadyCommand(testExec)(&req)
require.NoError(t, err)

assert.Len(t, req.LifecycleHooks, 1)
assert.Len(t, req.LifecycleHooks[0].PostReadies, 1)
require.Len(t, req.LifecycleHooks, 1)
require.Len(t, req.LifecycleHooks[0].PostReadies, 1)

c, err := testcontainers.GenericContainer(context.Background(), req)
testcontainers.CleanupContainer(t, c)
Expand Down