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

dhui / dktest / 10734612723

06 Sep 2024 07:53AM UTC coverage: 66.893%. Remained the same
10734612723

push

github

web-flow
upgrade docker version and go (#36)

* upgrade docker version and go

* fix rand, deprecated, ioutil

* update rand.go to allow unsecure random int

* spacing

* add later versions of go for suppoert

* undo circle ci changes

* bump docker

* clean up deprecated

10 of 42 new or added lines in 4 files covered. (23.81%)

8 existing lines in 2 files now uncovered.

295 of 441 relevant lines covered (66.89%)

64.12 hits per line

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

24.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,
NEW
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,
NEW
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) {
16✔
47
        if c.CreateResp == nil {
18✔
48
                return container.CreateResponse{}, Err
2✔
49
        }
2✔
50
        return *c.CreateResp, nil
14✔
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,
NEW
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,
NEW
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,
NEW
81
        string) (container.ExecInspect, error) {
×
NEW
82
        return container.ExecInspect{}, nil
×
UNCOV
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,
NEW
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,
NEW
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) {
4✔
110
        if c.InspectResp == nil {
6✔
111
                return types.ContainerJSON{}, Err
2✔
112
        }
2✔
113
        return *c.InspectResp, nil
2✔
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,
NEW
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) {
8✔
142
        if c.Logs == nil {
10✔
143
                return nil, Err
2✔
144
        }
2✔
145
        return c.Logs, nil
6✔
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 {
14✔
156
        return c.RemoveErr
14✔
157
}
14✔
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
NEW
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,
NEW
184
        string) (container.PathStat, error) {
×
NEW
185
        return container.PathStat{}, nil
×
UNCOV
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,
NEW
192
        bool) (container.StatsResponseReader, error) {
×
NEW
193
        return container.StatsResponseReader{}, nil
×
UNCOV
194
}
×
195

196
// ContainerStatsOneShot is a mock implementation of Docker's client.ContainerAPIClient.ContainerStatsOneShot()
197
//
198
// TODO: properly implement
NEW
199
func (c *ContainerAPIClient) ContainerStatsOneShot(context.Context, string) (container.StatsResponseReader, error) {
×
NEW
200
        return container.StatsResponseReader{}, nil
×
UNCOV
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 {
14✔
206
        return c.StartErr
14✔
207
}
14✔
208

209
// ContainerStop is a mock implementation of Docker's client.ContainerAPIClient.ContainerStop()
210
func (c *ContainerAPIClient) ContainerStop(context.Context, string, container.StopOptions) error {
14✔
211
        return c.StopErr
14✔
212
}
14✔
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,
NEW
249
        container.PathStat, error) {
×
NEW
250
        return nil, container.PathStat{}, nil
×
UNCOV
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,
NEW
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
NEW
264
func (c *ContainerAPIClient) ContainersPrune(context.Context, filters.Args) (container.PruneReport, error) {
×
NEW
265
        return container.PruneReport{}, nil
×
UNCOV
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