Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Jan 24, 2024
1 parent 88e1961 commit b051c90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ func TestLifecycleHooks_WithDefaultLogger(t *testing.T) {
err = c.Terminate(ctx)
require.NoError(t, err)

require.Equal(t, 12, len(dl.data))
require.Len(t, dl.data, 12)
}

func TestCombineLifecycleHooks(t *testing.T) {
Expand Down Expand Up @@ -661,26 +661,26 @@ func TestCombineLifecycleHooks(t *testing.T) {

req := ContainerRequest{}
err := hooks.Creating(context.Background())(req)
require.Nil(t, err)
require.NoError(t, err)

c := &DockerContainer{}

err = hooks.Created(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)
err = hooks.Starting(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)
err = hooks.Started(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)
err = hooks.Readied(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)
err = hooks.Stopping(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)
err = hooks.Stopped(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)
err = hooks.Terminating(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)
err = hooks.Terminated(context.Background())(c)
require.Nil(t, err)
require.NoError(t, err)

// assertions

Expand All @@ -690,7 +690,7 @@ func TestCombineLifecycleHooks(t *testing.T) {

// There are 5 lifecycles (create, start, ready, stop, terminate),
// but ready has only half of the hooks (it only has post), so we have 90 hooks in total.
assert.Equal(t, 90, len(prints))
assert.Len(t, prints, 90)

// The order of the hooks is:
// - pre-X hooks: first default (2*2), then user-defined (3*2)
Expand Down Expand Up @@ -779,7 +779,7 @@ func TestLifecycleHooks_WithMultipleHooks(t *testing.T) {
err = c.Terminate(ctx)
require.NoError(t, err)

require.Equal(t, 24, len(dl.data))
require.Len(t, dl.data, 24)
}

type linesTestLogger struct {
Expand Down Expand Up @@ -847,7 +847,7 @@ func TestPrintContainerLogsOnError(t *testing.T) {
}

func lifecycleHooksIsHonouredFn(t *testing.T, ctx context.Context, prints []string) {
require.Equal(t, 24, len(prints))
require.Len(t, prints, 24)

assert.True(t, strings.HasPrefix(prints[0], "pre-create hook 1: "))
assert.True(t, strings.HasPrefix(prints[1], "pre-create hook 2: "))
Expand Down
4 changes: 2 additions & 2 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func TestWithAfterReadyCommand(t *testing.T) {

testcontainers.WithAfterReadyCommand(testExec)(&req)

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

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

0 comments on commit b051c90

Please sign in to comment.