From 2c8bf677f01d5e9174addae2172032a6f8a23296 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 30 Jan 2026 10:40:23 +0100 Subject: [PATCH] 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 --- opts/mount_test.go | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/opts/mount_test.go b/opts/mount_test.go index c09441bbec..e25b82aec8 100644 --- a/opts/mount_test.go +++ b/opts/mount_test.go @@ -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) {