Check that mountpoints are created

This commit is contained in:
Matthieu Rakotojaona 2015-07-18 21:48:53 +02:00
parent 25b090a074
commit c9b3eebc09
2 changed files with 4 additions and 2 deletions

View file

@ -58,7 +58,7 @@ func (cmd CmdMount) Execute(args []string) error {
mountpoint := args[0]
if _, err := os.Stat(mountpoint); err != nil {
if os.IsNotExist(err) {
cmd.global.Verbosef("Mountpoint [%s] doesn't exist, creating it\n", mountpoint)
cmd.global.Verbosef("Mountpoint %s doesn't exist, creating it\n", mountpoint)
err = os.Mkdir(mountpoint, os.ModeDir|0755)
if err != nil {
return err

View file

@ -519,7 +519,9 @@ func TestMount(t *testing.T) {
mountpoint, err := ioutil.TempDir(TestTempDir, "restic-test-mount-")
OK(t, err)
defer OK(t, os.RemoveAll(mountpoint))
// We remove the mountpoint now to check that cmdMount creates it
OK(t, os.RemoveAll(mountpoint))
ready := make(chan struct{}, 1)
go cmdMount(t, global, mountpoint, ready)