@@ -9,16 +9,18 @@ import (
99"encoding/json"
1010"errors"
1111"fmt"
12- dockertypes "github.com/docker/docker/api/types"
13- dockercontainer "github.com/docker/docker/api/types/container"
14- dockernetwork "github.com/docker/docker/api/types/network"
15- dockerclient "github.com/docker/docker/client"
16- "github.com/hashicorp/go-multierror"
1712"io"
1813"math/rand/v2"
1914"strconv"
2015"strings"
2116"testing"
17+
18+ dockertypes "github.com/docker/docker/api/types"
19+ dockercontainer "github.com/docker/docker/api/types/container"
20+ dockerimage "github.com/docker/docker/api/types/image"
21+ dockernetwork "github.com/docker/docker/api/types/network"
22+ dockerclient "github.com/docker/docker/client"
23+ "github.com/hashicorp/go-multierror"
2224)
2325
2426func NewDockerContainer (t testing.TB , image string , env []string , cmd []string ) (* DockerContainer , error ) {
@@ -72,7 +74,7 @@ func (d *DockerContainer) PullImage() (err error) {
7274return errors .New ("Cannot pull image on a nil *DockerContainer" )
7375}
7476d .t .Logf ("Docker: Pull image %v" , d .ImageName )
75- r , err := d .client .ImagePull (context .Background (), d .ImageName , dockertypes. ImagePullOptions {})
77+ r , err := d .client .ImagePull (context .Background (), d .ImageName , dockerimage. PullOptions {})
7678if err != nil {
7779return err
7880}
@@ -125,7 +127,7 @@ func (d *DockerContainer) Start() error {
125127d .ContainerName = containerName
126128
127129// then start it
128- if err := d .client .ContainerStart (context .Background (), resp .ID , dockertypes. ContainerStartOptions {}); err != nil {
130+ if err := d .client .ContainerStart (context .Background (), resp .ID , dockercontainer. StartOptions {}); err != nil {
129131return err
130132}
131133
@@ -157,7 +159,7 @@ func (d *DockerContainer) Remove() error {
157159return errors .New ("missing containerId" )
158160}
159161if err := d .client .ContainerRemove (context .Background (), d .ContainerId ,
160- dockertypes. ContainerRemoveOptions {
162+ dockercontainer. RemoveOptions {
161163Force : true ,
162164}); err != nil {
163165d .t .Log (err )
@@ -193,7 +195,7 @@ func (d *DockerContainer) Logs() (io.ReadCloser, error) {
193195return nil , errors .New ("missing containerId" )
194196}
195197
196- return d .client .ContainerLogs (context .Background (), d .ContainerId , dockertypes. ContainerLogsOptions {
198+ return d .client .ContainerLogs (context .Background (), d .ContainerId , dockercontainer. LogsOptions {
197199ShowStdout : true ,
198200ShowStderr : true ,
199201})
0 commit comments