@@ -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" )
@@ -99,24 +99,24 @@ func createContainer(tb testing.TB, dockerClient client.SDKClient, img string, n
9999
100100 resp , err := dockerClient .ContainerCreate (context .Background (), & container.Config {
101101 Image : img ,
102- ExposedPorts : nat .PortSet {
103- "80/tcp" : {},
102+ ExposedPorts : network .PortSet {
103+ network . MustParsePort ( "80/tcp" ) : {},
104104 },
105105 }, nil , nil , nil , name )
106106 require .NoError (tb , err )
107107 require .NotNil (tb , resp )
108108 require .NotEmpty (tb , resp .ID )
109109
110110 tb .Cleanup (func () {
111- err := dockerClient .ContainerRemove (context .Background (), resp .ID , container. RemoveOptions {Force : true })
111+ err := dockerClient .ContainerRemove (context .Background (), resp .ID , dockerclient. ContainerRemoveOptions {Force : true })
112112 require .NoError (tb , err )
113113 })
114114}
115115
116116func pullImage (tb testing.TB , client client.SDKClient , img string ) {
117117 tb .Helper ()
118118
119- r , err := client .ImagePull (context .Background (), img , image. PullOptions {})
119+ r , err := client .ImagePull (context .Background (), img , dockerclient. ImagePullOptions {})
120120 require .NoError (tb , err )
121121 defer r .Close ()
122122
0 commit comments