@@ -8,11 +8,11 @@ import (
88 "testing"
99
1010 "github.com/containerd/errdefs"
11+ "github.com/moby/moby/api/types/container"
12+ "github.com/moby/moby/api/types/network"
13+ dockerclient "github.com/moby/moby/client"
1114 "github.com/stretchr/testify/require"
1215
13- "github.com/docker/docker/api/types/container"
14- "github.com/docker/docker/api/types/image"
15- "github.com/docker/go-connections/nat"
1616 "github.com/docker/go-sdk/client"
1717)
1818
@@ -40,7 +40,7 @@ func TestContainerList(t *testing.T) {
4040
4141 wg .Wait ()
4242
43- containers , err := dockerClient .ContainerList (context .Background (), container. ListOptions {All : true })
43+ containers , err := dockerClient .ContainerList (context .Background (), dockerclient. ContainerListOptions {All : true })
4444 require .NoError (t , err )
4545 require .NotEmpty (t , containers )
4646 require .Len (t , containers , max )
@@ -84,7 +84,7 @@ func TestContainerPause(t *testing.T) {
8484 pullImage (t , dockerClient , img )
8585 createContainer (t , dockerClient , img , "nginx-test-pause" )
8686
87- err = dockerClient .ContainerStart (context .Background (), "nginx-test-pause" , container. StartOptions {})
87+ err = dockerClient .ContainerStart (context .Background (), "nginx-test-pause" , dockerclient. ContainerStartOptions {})
8888 require .NoError (t , err )
8989
9090 err = dockerClient .ContainerPause (context .Background (), "nginx-test-pause" )
@@ -97,26 +97,29 @@ func TestContainerPause(t *testing.T) {
9797func createContainer (tb testing.TB , dockerClient client.SDKClient , img string , name string ) {
9898 tb .Helper ()
9999
100- resp , err := dockerClient .ContainerCreate (context .Background (), & container.Config {
101- Image : img ,
102- ExposedPorts : nat.PortSet {
103- "80/tcp" : {},
100+ resp , err := dockerClient .ContainerCreate (context .Background (), dockerclient.ContainerCreateOptions {
101+ Config : & container.Config {
102+ Image : img ,
103+ ExposedPorts : network.PortSet {
104+ network .MustParsePort ("80/tcp" ): {},
105+ },
104106 },
105- }, nil , nil , nil , name )
107+ Name : name ,
108+ })
106109 require .NoError (tb , err )
107110 require .NotNil (tb , resp )
108111 require .NotEmpty (tb , resp .ID )
109112
110113 tb .Cleanup (func () {
111- err := dockerClient .ContainerRemove (context .Background (), resp .ID , container. RemoveOptions {Force : true })
114+ err := dockerClient .ContainerRemove (context .Background (), resp .ID , dockerclient. ContainerRemoveOptions {Force : true })
112115 require .NoError (tb , err )
113116 })
114117}
115118
116119func pullImage (tb testing.TB , client client.SDKClient , img string ) {
117120 tb .Helper ()
118121
119- r , err := client .ImagePull (context .Background (), img , image. PullOptions {})
122+ r , err := client .ImagePull (context .Background (), img , dockerclient. ImagePullOptions {})
120123 require .NoError (tb , err )
121124 defer r .Close ()
122125
0 commit comments