mirror of https://github.com/ceph/go-ceph
cephfs: TestMountWithRoot should only try unmounting after mounting
The defer function in TestMountWithRoot was always trying to call unmount before release. This is not correct if the fs was not mounted so we reorganize this code to more closely match what should be done in normal practice. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
6a08124775
commit
bdee9f4aab
|
@ -354,7 +354,6 @@ func TestMountWithRoot(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, mount)
|
require.NotNil(t, mount)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, mount.Unmount())
|
|
||||||
assert.NoError(t, mount.Release())
|
assert.NoError(t, mount.Release())
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -363,6 +362,9 @@ func TestMountWithRoot(t *testing.T) {
|
||||||
|
|
||||||
err = mount.MountWithRoot(dir1)
|
err = mount.MountWithRoot(dir1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
defer func() {
|
||||||
|
assert.NoError(t, mount.Unmount())
|
||||||
|
}()
|
||||||
|
|
||||||
err = mount.ChangeDir(sub1)
|
err = mount.ChangeDir(sub1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
Loading…
Reference in New Issue