-
-
Notifications
You must be signed in to change notification settings - Fork 603
Expand file tree
/
Copy pathdocker_client_test.go
More file actions
42 lines (35 loc) · 813 Bytes
/
docker_client_test.go
File metadata and controls
42 lines (35 loc) · 813 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
38
39
40
41
42
package testcontainers
import (
"context"
"sync"
"testing"
"github.com/moby/moby/client"
"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, client.InfoOptions{})
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 range count {
go func() {
defer wg.Done()
info, err := c.Info(ctx, client.InfoOptions{})
require.NoError(t, err)
require.NotNil(t, info)
}()
}
wg.Wait()
})
}