From c9b3eebc09d136c693fea267ca3490e74c13ae79 Mon Sep 17 00:00:00 2001 From: Matthieu Rakotojaona Date: Sat, 18 Jul 2015 21:48:53 +0200 Subject: [PATCH] Check that mountpoints are created --- cmd/restic/cmd_mount.go | 2 +- cmd/restic/integration_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 28a4dd18d..269386523 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -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 diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go index b6e814009..9a08cd932 100644 --- a/cmd/restic/integration_test.go +++ b/cmd/restic/integration_test.go @@ -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)