-
-
Notifications
You must be signed in to change notification settings - Fork 605
Expand file tree
/
Copy pathoptions_unit_test.go
More file actions
37 lines (26 loc) · 892 Bytes
/
options_unit_test.go
File metadata and controls
37 lines (26 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package testcontainers
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go/exec"
)
func TestWithStartupCommand_unit(t *testing.T) {
req := GenericContainerRequest{
ContainerRequest: ContainerRequest{},
}
testExec := NewRawCommand([]string{"touch", ".testcontainers"}, exec.WithWorkingDir("/tmp"))
err := WithStartupCommand(testExec)(&req)
require.NoError(t, err)
require.Len(t, req.LifecycleHooks, 1)
require.Len(t, req.LifecycleHooks[0].PostStarts, 1)
}
func TestWithAfterReadyCommand_unit(t *testing.T) {
req := GenericContainerRequest{
ContainerRequest: ContainerRequest{},
}
testExec := NewRawCommand([]string{"touch", "/tmp/.testcontainers"})
err := WithAfterReadyCommand(testExec)(&req)
require.NoError(t, err)
require.Len(t, req.LifecycleHooks, 1)
require.Len(t, req.LifecycleHooks[0].PostReadies, 1)
}