Skip to content

Commit

Permalink
Revert "Fix error message without var detail(per Dana review UB-1230)…
Browse files Browse the repository at this point in the history
… and fix fake file"

This reverts commit 088cfb3.
  • Loading branch information
shay-berman committed Jun 3, 2018
1 parent 088cfb3 commit 7ffc785
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,25 @@ var _ = Describe("block_device_mounter_utils_test", func() {

})

It("should fail if IsDirAMountPoint failed", func() {
It("should fail if IsDirIsAMountPoint failed", func() {
fakeBlockDeviceUtils.CheckFsReturns(true, nil)
fakeBlockDeviceUtils.IsDeviceMountedReturns(false, nil, nil)
fakeBlockDeviceUtils.IsDirAMountPointReturns(false, nil, callErr)
fakeBlockDeviceUtils.IsDirIsAMountPointReturns(false, nil, callErr)
err = blockDeviceMounterUtils.MountDeviceFlow("fake_device", "fake_fstype", "fake_mountp")
Expect(err).To(HaveOccurred())
Expect(err).To(MatchError(callErr))
Expect(fakeBlockDeviceUtils.IsDirAMountPointCallCount()).To(Equal(1))
Expect(fakeBlockDeviceUtils.IsDirIsAMountPointCallCount()).To(Equal(1))
})

It("should fail to mount if mountpoint is already mounted to wrong device", func() {
fakeBlockDeviceUtils.CheckFsReturns(true, nil)
fakeBlockDeviceUtils.IsDeviceMountedReturns(false, nil, nil)
fakeBlockDeviceUtils.IsDirAMountPointReturns(true, []string{"/dev/mapper/mpathvfake1", "/dev/mapper/mpathvfake2"}, nil)
fakeBlockDeviceUtils.IsDirIsAMountPointReturns(true, nil, nil)
err = blockDeviceMounterUtils.MountDeviceFlow("fake_device", "fake_fstype", "fake_mountp")
Expect(err).To(HaveOccurred())
_, ok := err.(*block_device_mounter_utils.DirPathAlreadyMountedToWrongDevice)
Expect(ok).To(Equal(true))
Expect(fakeBlockDeviceUtils.IsDirAMountPointCallCount()).To(Equal(1))
Expect(fakeBlockDeviceUtils.IsDirIsAMountPointCallCount()).To(Equal(1))
Expect(fakeBlockDeviceUtils.MountFsCallCount()).To(Equal(0))

})
Expand All @@ -162,7 +162,7 @@ var _ = Describe("block_device_mounter_utils_test", func() {
fakeBlockDeviceUtils.CheckFsReturns(true, nil)
fakeBlockDeviceUtils.MakeFsReturns(nil)
fakeBlockDeviceUtils.MountFsReturns(callErr)
fakeBlockDeviceUtils.IsDirAMountPointReturns(false, nil, nil)
fakeBlockDeviceUtils.IsDirIsAMountPointReturns(false, nil, nil)

err = blockDeviceMounterUtils.MountDeviceFlow("fake_device", "fake_fstype", "fake_mountp")
Expect(err).To(HaveOccurred())
Expand All @@ -173,7 +173,7 @@ var _ = Describe("block_device_mounter_utils_test", func() {
fakeBlockDeviceUtils.CheckFsReturns(true, nil)
fakeBlockDeviceUtils.MakeFsReturns(nil)
fakeBlockDeviceUtils.MountFsReturns(nil)
fakeBlockDeviceUtils.IsDirAMountPointReturns(false, nil, nil)
fakeBlockDeviceUtils.IsDirIsAMountPointReturns(false, nil, nil)

err = blockDeviceMounterUtils.MountDeviceFlow("fake_device", "fake_fstype", "fake_mountp")
Expect(err).NotTo(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion remote/mounter/block_device_mounter_utils/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ type DirPathAlreadyMountedToWrongDevice struct {
}

func (e *DirPathAlreadyMountedToWrongDevice) Error() string {
return fmt.Sprintf("[%s] directory is already a mountpoint but to unexpected devices=%v (expected mountpoint only on device=[%s])",
return fmt.Sprintf("[%s] directory is already a mountpoint but to unexpected devices=%#v (expected mountpoint only on device=[%s])",
e.mountPoint, e.unexpectedDevicesRefs, e.expectedDevice)
}

0 comments on commit 7ffc785

Please sign in to comment.