-
-
Notifications
You must be signed in to change notification settings - Fork 482
/
docker_client_test.go
41 lines (34 loc) · 749 Bytes
/
docker_client_test.go
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
38
39
40
41
package testcontainers
import (
"context"
"sync"
"testing"
"github.com/stretchr/testify/require"
)
func TestGetDockerInfo(t *testing.T) {
t.Run("works", func(t *testing.T) {
ctx := context.Background()
c, err := NewDockerClientWithOpts(ctx)
require.NoError(t, err)
info, err := c.Info(ctx)
require.NoError(t, err)
require.NotNil(t, info)
})
t.Run("is goroutine safe", func(t *testing.T) {
ctx := context.Background()
c, err := NewDockerClientWithOpts(ctx)
require.NoError(t, err)
count := 1024
wg := sync.WaitGroup{}
wg.Add(count)
for i := 0; i < count; i++ {
go func() {
defer wg.Done()
info, err := c.Info(ctx)
require.NoError(t, err)
require.NotNil(t, info)
}()
}
wg.Wait()
})
}