1
0
mirror of https://github.com/docker/cli.git synced 2026-11-01 23:35:23 +03:00

opts: MountOpt: remove duplicate test

Setting the source and target paths is not tied to the mount-type,
so these tests where covering the same code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-01-30 10:40:23 +01:00
parent 7ebc2f7c21
commit 2c8bf677f0

View File

@@ -73,14 +73,13 @@ func TestMountRelative(t *testing.T) {
}
}
// TestMountOptSetBindNoErrorBind tests several aliases that should have
// TestMountOptSourceTargetAliases tests several aliases that should have
// the same result.
func TestMountOptSetBindNoErrorBind(t *testing.T) {
func TestMountOptSourceTargetAliases(t *testing.T) {
for _, tc := range []string{
"type=bind,target=/target,source=/source",
"type=bind,src=/source,dst=/target",
"type=bind,source=/source,dst=/target",
"type=bind,src=/source,target=/target",
"type=bind,source=/source,target=/target",
"type=bind,source=/source,destination=/target",
} {
t.Run(tc, func(t *testing.T) {
var m MountOpt
@@ -98,31 +97,6 @@ func TestMountOptSetBindNoErrorBind(t *testing.T) {
}
}
// TestMountOptSetVolumeNoError tests several aliases that should have
// the same result.
func TestMountOptSetVolumeNoError(t *testing.T) {
for _, tc := range []string{
"type=volume,target=/target,source=/source",
"type=volume,src=/source,dst=/target",
"type=volume,source=/source,dst=/target",
"type=volume,src=/source,target=/target",
} {
t.Run(tc, func(t *testing.T) {
var m MountOpt
assert.NilError(t, m.Set(tc))
mounts := m.Value()
assert.Assert(t, is.Len(mounts, 1))
assert.Check(t, is.DeepEqual(mount.Mount{
Type: mount.TypeVolume,
Source: "/source",
Target: "/target",
}, mounts[0]))
})
}
}
// TestMountOptDefaultType ensures that a mount without the type defaults to a
// volume mount.
func TestMountOptDefaultType(t *testing.T) {