Beispiel #1
0
// TODO this vs. bazil.org/fuse/fs/fstestutil#Mounted
func Mounted(t testing.TB, app *server.App, volumeName string) *Mount {
	mountpoint, err := ioutil.TempDir("", "bazil-test-")
	if err != nil {
		t.Fatal(err)
	}

	ref, err := app.GetVolumeByName(volumeName)
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if ref != nil {
			ref.Close()
		}
	}()
	// TODO make it log debug if `go test ./fs -fuse.debug`
	if err := ref.Mount(mountpoint); err != nil {
		t.Fatal(err)
	}

	mnt := &Mount{
		Dir: mountpoint,
		ref: ref,
	}
	// success -> tell the defer to not close the ref
	ref = nil
	return mnt
}
Beispiel #2
0
// TODO this vs. bazil.org/fuse/fs/fstestutil#Mounted
func Mounted(t testing.TB, app *server.App, volumeName string) *Mount {
	mountpoint, err := ioutil.TempDir("", "bazil-test-")
	if err != nil {
		t.Fatal(err)
	}

	// TODO make it log debug if `go test ./fs -fuse.debug`
	info, err := app.Mount(volumeName, mountpoint)
	if err != nil {
		t.Fatal(err)
	}

	mnt := &Mount{
		Dir:  mountpoint,
		Info: info,
		app:  app,
	}
	return mnt
}