88 "github.com/docker/cli/cli"
99 "github.com/docker/cli/internal/test"
1010 "github.com/moby/moby/api/types/container"
11+ "github.com/moby/moby/client"
1112 "gotest.tools/v3/assert"
1213)
1314
@@ -16,24 +17,26 @@ func TestNewAttachCommandErrors(t *testing.T) {
1617 name string
1718 args []string
1819 expectedError string
19- containerInspectFunc func (img string ) (container. InspectResponse , error )
20+ containerInspectFunc func (img string ) (client. ContainerInspectResult , error )
2021 }{
2122 {
2223 name : "client-error" ,
2324 args : []string {"5cb5bb5e4a3b" },
2425 expectedError : "something went wrong" ,
25- containerInspectFunc : func (containerID string ) (container. InspectResponse , error ) {
26- return container. InspectResponse {}, errors .New ("something went wrong" )
26+ containerInspectFunc : func (containerID string ) (client. ContainerInspectResult , error ) {
27+ return client. ContainerInspectResult {}, errors .New ("something went wrong" )
2728 },
2829 },
2930 {
3031 name : "client-stopped" ,
3132 args : []string {"5cb5bb5e4a3b" },
3233 expectedError : "cannot attach to a stopped container" ,
33- containerInspectFunc : func (containerID string ) (container.InspectResponse , error ) {
34- return container.InspectResponse {
35- State : & container.State {
36- Running : false ,
34+ containerInspectFunc : func (containerID string ) (client.ContainerInspectResult , error ) {
35+ return client.ContainerInspectResult {
36+ Container : container.InspectResponse {
37+ State : & container.State {
38+ Running : false ,
39+ },
3740 },
3841 }, nil
3942 },
@@ -42,11 +45,13 @@ func TestNewAttachCommandErrors(t *testing.T) {
4245 name : "client-paused" ,
4346 args : []string {"5cb5bb5e4a3b" },
4447 expectedError : "cannot attach to a paused container" ,
45- containerInspectFunc : func (containerID string ) (container.InspectResponse , error ) {
46- return container.InspectResponse {
47- State : & container.State {
48- Running : true ,
49- Paused : true ,
48+ containerInspectFunc : func (containerID string ) (client.ContainerInspectResult , error ) {
49+ return client.ContainerInspectResult {
50+ Container : container.InspectResponse {
51+ State : & container.State {
52+ Running : true ,
53+ Paused : true ,
54+ },
5055 },
5156 }, nil
5257 },
@@ -55,12 +60,14 @@ func TestNewAttachCommandErrors(t *testing.T) {
5560 name : "client-restarting" ,
5661 args : []string {"5cb5bb5e4a3b" },
5762 expectedError : "cannot attach to a restarting container" ,
58- containerInspectFunc : func (containerID string ) (container.InspectResponse , error ) {
59- return container.InspectResponse {
60- State : & container.State {
61- Running : true ,
62- Paused : false ,
63- Restarting : true ,
63+ containerInspectFunc : func (containerID string ) (client.ContainerInspectResult , error ) {
64+ return client.ContainerInspectResult {
65+ Container : container.InspectResponse {
66+ State : & container.State {
67+ Running : true ,
68+ Paused : false ,
69+ Restarting : true ,
70+ },
6471 },
6572 }, nil
6673 },
0 commit comments