• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dhui / dktest / 17080458550

19 Aug 2025 08:00PM UTC coverage: 58.636% (-7.5%) from 66.136%
17080458550

Pull #45

github

dhui
Support Go 1.25 and drop support for Go 1.23
Pull Request #45: Support Go 1.25 and drop support for Go 1.23

258 of 440 relevant lines covered (58.64%)

64.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/mockdockerclient/container_api_client.go
1
package mockdockerclient
2

3
import (
4
        "context"
5
        "io"
6

7
        "github.com/docker/docker/api/types"
8
        "github.com/docker/docker/api/types/container"
9
        "github.com/docker/docker/api/types/filters"
10
        "github.com/docker/docker/api/types/network"
11
        "github.com/docker/docker/client"
12

13
        v1 "github.com/opencontainers/image-spec/specs-go/v1"
14
)
15

16
// ContainerAPIClient is a mock implementation of the Docker's client.ContainerAPIClient interface
17
type ContainerAPIClient struct {
18
        CreateResp  *container.CreateResponse
19
        StartErr    error
20
        StopErr     error
21
        RemoveErr   error
22
        InspectResp *types.ContainerJSON
23
        Logs        io.ReadCloser
24
}
25

26
var _ client.ContainerAPIClient = (*ContainerAPIClient)(nil)
27

28
// ContainerAttach is a mock implementation of Docker's client.ContainerAPIClient.ContainerAttach()
29
//
30
// TODO: properly implement
31
func (c *ContainerAPIClient) ContainerAttach(context.Context, string,
32
        container.AttachOptions) (types.HijackedResponse, error) {
×
33
        return types.HijackedResponse{}, nil
×
34
}
×
35

36
// ContainerCommit is a mock implementation of Docker's client.ContainerAPIClient.ContainerCommit()
37
//
38
// TODO: properly implement
39
func (c *ContainerAPIClient) ContainerCommit(context.Context, string,
40
        container.CommitOptions) (types.IDResponse, error) {
×
41
        return types.IDResponse{}, nil
×
42
}
×
43

44
// ContainerCreate is a mock implementation of Docker's client.ContainerAPIClient.ContainerCreate()
45
func (c *ContainerAPIClient) ContainerCreate(context.Context, *container.Config, *container.HostConfig,
46
        *network.NetworkingConfig, *v1.Platform, string) (container.CreateResponse, error) {
×
47
        if c.CreateResp == nil {
×
48
                return container.CreateResponse{}, Err
×
49
        }
×
50
        return *c.CreateResp, nil
×
51
}
52

53
// ContainerDiff is a mock implementation of Docker's client.ContainerAPIClient.ContainerDiff()
54
//
55
// TODO: properly implement
56
func (c *ContainerAPIClient) ContainerDiff(context.Context,
57
        string) ([]container.FilesystemChange, error) {
×
58
        return nil, nil
×
59
}
×
60

61
// ContainerExecAttach is a mock implementation of Docker's client.ContainerAPIClient.ContainerExecAttach()
62
//
63
// TODO: properly implement
64
func (c *ContainerAPIClient) ContainerExecAttach(context.Context, string,
65
        container.ExecStartOptions) (types.HijackedResponse, error) {
×
66
        return types.HijackedResponse{}, nil
×
67
}
×
68

69
// ContainerExecCreate is a mock implementation of Docker's client.ContainerAPIClient.ContainerExecCreate()
70
//
71
// TODO: properly implement
72
func (c *ContainerAPIClient) ContainerExecCreate(context.Context, string,
73
        container.ExecOptions) (types.IDResponse, error) {
×
74
        return types.IDResponse{}, nil
×
75
}
×
76

77
// ContainerExecInspect is a mock implementation of Docker's client.ContainerAPIClient.ContainerExecInspect()
78
//
79
// TODO: properly implement
80
func (c *ContainerAPIClient) ContainerExecInspect(context.Context,
81
        string) (container.ExecInspect, error) {
×
82
        return container.ExecInspect{}, nil
×
83
}
×
84

85
// ContainerExecResize is a mock implementation of Docker's client.ContainerAPIClient.ContainerExecResize()
86
//
87
// TODO: properly implement
88
func (c *ContainerAPIClient) ContainerExecResize(context.Context, string,
89
        container.ResizeOptions) error {
×
90
        return nil
×
91
}
×
92

93
// ContainerExecStart is a mock implementation of Docker's client.ContainerAPIClient.ContainerExecStart()
94
//
95
// TODO: properly implement
96
func (c *ContainerAPIClient) ContainerExecStart(context.Context, string,
97
        container.ExecStartOptions) error {
×
98
        return nil
×
99
}
×
100

101
// ContainerExport is a mock implementation of Docker's client.ContainerAPIClient.ContainerExport()
102
//
103
// TODO: properly implement
104
func (c *ContainerAPIClient) ContainerExport(context.Context, string) (io.ReadCloser, error) {
×
105
        return nil, nil
×
106
}
×
107

108
// ContainerInspect is a mock implementation of Docker's client.ContainerAPIClient.ContainerInspect()
109
func (c *ContainerAPIClient) ContainerInspect(context.Context, string) (types.ContainerJSON, error) {
×
110
        if c.InspectResp == nil {
×
111
                return types.ContainerJSON{}, Err
×
112
        }
×
113
        return *c.InspectResp, nil
×
114
}
115

116
// ContainerInspectWithRaw is a mock implementation of Docker's client.ContainerAPIClient.ContainerInspectWithRaw()
117
//
118
// TODO: properly implement
119
func (c *ContainerAPIClient) ContainerInspectWithRaw(context.Context, string,
120
        bool) (types.ContainerJSON, []byte, error) {
×
121
        return types.ContainerJSON{}, nil, nil
×
122
}
×
123

124
// ContainerKill is a mock implementation of Docker's client.ContainerAPIClient.ContainerKill()
125
//
126
// TODO: properly implement
127
func (c *ContainerAPIClient) ContainerKill(context.Context, string, string) error {
×
128
        return nil
×
129
}
×
130

131
// ContainerList is a mock implementation of Docker's client.ContainerAPIClient.ContainerList()
132
//
133
// TODO: properly implement
134
func (c *ContainerAPIClient) ContainerList(context.Context,
135
        container.ListOptions) ([]types.Container, error) {
×
136
        return nil, nil
×
137
}
×
138

139
// ContainerLogs is a mock implementation of Docker's client.ContainerAPIClient.ContainerLogs()
140
func (c *ContainerAPIClient) ContainerLogs(context.Context, string,
141
        container.LogsOptions) (io.ReadCloser, error) {
×
142
        if c.Logs == nil {
×
143
                return nil, Err
×
144
        }
×
145
        return c.Logs, nil
×
146
}
147

148
// ContainerPause is a mock implementation of Docker's client.ContainerAPIClient.ContainerPause()
149
//
150
// TODO: properly implement
151
func (c *ContainerAPIClient) ContainerPause(context.Context, string) error { return nil }
×
152

153
// ContainerRemove is a mock implementation of Docker's client.ContainerAPIClient.ContainerRemove()
154
func (c *ContainerAPIClient) ContainerRemove(context.Context, string,
155
        container.RemoveOptions) error {
×
156
        return c.RemoveErr
×
157
}
×
158

159
// ContainerRename is a mock implementation of Docker's client.ContainerAPIClient.ContainerRename()
160
//
161
// TODO: properly implement
162
func (c *ContainerAPIClient) ContainerRename(context.Context, string, string) error {
×
163
        return nil
×
164
}
×
165

166
// ContainerResize is a mock implementation of Docker's client.ContainerAPIClient.ContainerResize()
167
//
168
// TODO: properly implement
169
func (c *ContainerAPIClient) ContainerResize(context.Context, string, container.ResizeOptions) error {
×
170
        return nil
×
171
}
×
172

173
// ContainerRestart is a mock implementation of Docker's client.ContainerAPIClient.ContainerRestart()
174
//
175
// TODO: properly implement
176
func (c *ContainerAPIClient) ContainerRestart(context.Context, string, container.StopOptions) error {
×
177
        return nil
×
178
}
×
179

180
// ContainerStatPath is a mock implementation of Docker's client.ContainerAPIClient.ContainerStatPath()
181
//
182
// TODO: properly implement
183
func (c *ContainerAPIClient) ContainerStatPath(context.Context, string,
184
        string) (container.PathStat, error) {
×
185
        return container.PathStat{}, nil
×
186
}
×
187

188
// ContainerStats is a mock implementation of Docker's client.ContainerAPIClient.ContainerStats()
189
//
190
// TODO: properly implement
191
func (c *ContainerAPIClient) ContainerStats(context.Context, string,
192
        bool) (container.StatsResponseReader, error) {
×
193
        return container.StatsResponseReader{}, nil
×
194
}
×
195

196
// ContainerStatsOneShot is a mock implementation of Docker's client.ContainerAPIClient.ContainerStatsOneShot()
197
//
198
// TODO: properly implement
199
func (c *ContainerAPIClient) ContainerStatsOneShot(context.Context, string) (container.StatsResponseReader, error) {
×
200
        return container.StatsResponseReader{}, nil
×
201
}
×
202

203
// ContainerStart is a mock implementation of Docker's client.ContainerAPIClient.ContainerStart()
204
func (c *ContainerAPIClient) ContainerStart(context.Context, string,
205
        container.StartOptions) error {
×
206
        return c.StartErr
×
207
}
×
208

209
// ContainerStop is a mock implementation of Docker's client.ContainerAPIClient.ContainerStop()
210
func (c *ContainerAPIClient) ContainerStop(context.Context, string, container.StopOptions) error {
×
211
        return c.StopErr
×
212
}
×
213

214
// ContainerTop is a mock implementation of Docker's client.ContainerAPIClient.ContainerTop()
215
//
216
// TODO: properly implement
217
func (c *ContainerAPIClient) ContainerTop(context.Context, string,
218
        []string) (container.ContainerTopOKBody, error) {
×
219
        return container.ContainerTopOKBody{}, nil
×
220
}
×
221

222
// ContainerUnpause is a mock implementation of Docker's client.ContainerAPIClient.ContainerUnpause()
223
//
224
// TODO: properly implement
225
func (c *ContainerAPIClient) ContainerUnpause(context.Context, string) error {
×
226
        return nil
×
227
}
×
228

229
// ContainerUpdate is a mock implementation of Docker's client.ContainerAPIClient.ContainerUpdate()
230
//
231
// TODO: properly implement
232
func (c *ContainerAPIClient) ContainerUpdate(context.Context, string,
233
        container.UpdateConfig) (container.ContainerUpdateOKBody, error) {
×
234
        return container.ContainerUpdateOKBody{}, nil
×
235
}
×
236

237
// ContainerWait is a mock implementation of Docker's client.ContainerAPIClient.ContainerWait()
238
//
239
// TODO: properly implement
240
func (c *ContainerAPIClient) ContainerWait(context.Context, string,
241
        container.WaitCondition) (<-chan container.WaitResponse, <-chan error) {
×
242
        return nil, nil
×
243
}
×
244

245
// CopyFromContainer is a mock implementation of Docker's client.ContainerAPIClient.CopyFromContainer()
246
//
247
// TODO: properly implement
248
func (c *ContainerAPIClient) CopyFromContainer(context.Context, string, string) (io.ReadCloser,
249
        container.PathStat, error) {
×
250
        return nil, container.PathStat{}, nil
×
251
}
×
252

253
// CopyToContainer is a mock implementation of Docker's client.ContainerAPIClient.CopyToContainer()
254
//
255
// TODO: properly implement
256
func (c *ContainerAPIClient) CopyToContainer(context.Context, string, string, io.Reader,
257
        container.CopyToContainerOptions) error {
×
258
        return nil
×
259
}
×
260

261
// ContainersPrune is a mock implementation of Docker's client.ContainerAPIClient.ContainersPrune()
262
//
263
// TODO: properly implement
264
func (c *ContainerAPIClient) ContainersPrune(context.Context, filters.Args) (container.PruneReport, error) {
×
265
        return container.PruneReport{}, nil
×
266
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc