MCPcopy Index your code
hub / github.com/docker/cli / TestMountOptVolumeOptions

Function TestMountOptVolumeOptions

opts/mount_test.go:269–429  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

267}
268
269func TestMountOptVolumeOptions(t *testing.T) {
270 tests := []struct {
271 doc string
272 value string
273 exp mount.Mount
274 }{
275 {
276 doc: "volume-label single",
277 value: `type=volume,target=/foo,volume-label=foo=foo-value`,
278 exp: mount.Mount{
279 Type: mount.TypeVolume,
280 Target: "/foo",
281 VolumeOptions: &mount.VolumeOptions{
282 Labels: map[string]string{
283 "foo": "foo-value",
284 },
285 },
286 },
287 },
288 {
289 doc: "volume-label multiple",
290 value: `type=volume,target=/foo,volume-label=foo=foo-value,volume-label=bar=bar-value`,
291 exp: mount.Mount{
292 Type: mount.TypeVolume,
293 Target: "/foo",
294 VolumeOptions: &mount.VolumeOptions{
295 Labels: map[string]string{
296 "foo": "foo-value",
297 "bar": "bar-value",
298 },
299 },
300 },
301 },
302 {
303 doc: "volume-label empty values",
304 value: `type=volume,target=/foo,volume-label=foo=,volume-label=bar`,
305 exp: mount.Mount{
306 Type: mount.TypeVolume,
307 Target: "/foo",
308 VolumeOptions: &mount.VolumeOptions{
309 Labels: map[string]string{
310 "foo": "",
311 "bar": "",
312 },
313 },
314 },
315 },
316 {
317 // TODO(thaJeztah): this should probably be an error instead
318 doc: "volume-label empty key",
319 value: `type=volume,target=/foo,volume-label==foo-value`,
320 exp: mount.Mount{
321 Type: mount.TypeVolume,
322 Target: "/foo",
323 VolumeOptions: &mount.VolumeOptions{},
324 },
325 },
326 {

Callers

nothing calls this directly

Calls 1

SetMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…