TestMountOptSourceTargetAliases tests several aliases that should have the same result.
(t *testing.T)
| 76 | // TestMountOptSourceTargetAliases tests several aliases that should have |
| 77 | // the same result. |
| 78 | func TestMountOptSourceTargetAliases(t *testing.T) { |
| 79 | for _, tc := range []string{ |
| 80 | "type=bind,src=/source,dst=/target", |
| 81 | "type=bind,source=/source,target=/target", |
| 82 | "type=bind,source=/source,destination=/target", |
| 83 | } { |
| 84 | t.Run(tc, func(t *testing.T) { |
| 85 | var m MountOpt |
| 86 | |
| 87 | assert.NilError(t, m.Set(tc)) |
| 88 | |
| 89 | mounts := m.Value() |
| 90 | assert.Assert(t, is.Len(mounts, 1)) |
| 91 | assert.Check(t, is.DeepEqual(mount.Mount{ |
| 92 | Type: mount.TypeBind, |
| 93 | Source: "/source", |
| 94 | Target: "/target", |
| 95 | }, mounts[0])) |
| 96 | }) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | // TestMountOptDefaultType ensures that a mount without the type defaults to a |
| 101 | // volume mount. |