fstestutil

package
v0.0.0-...-87407f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2014 License: BSD-2-Clause, BSD-3-Clause, HPND Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugByDefault

func DebugByDefault()

DebugByDefault changes the default of the `-fuse.debug` flag to true.

This package registers a command line flag `-fuse.debug` and when run with that flag (and activated inside the tests), logs FUSE debug messages.

This is disabled by default, as most callers probably won't care about FUSE details. Use DebugByDefault for tests where you'd normally be passing `-fuse.debug` all the time anyway.

Call from an init function.

Types

type Mount

type Mount struct {
	// Dir is the temporary directory where the filesystem is mounted.
	Dir string

	Conn *fuse.Conn

	// Error will receive the return value of Serve.
	Error <-chan error
	// contains filtered or unexported fields
}

Mount contains information about the mount for the test to use.

func Mounted

func Mounted(srv *fs.Server) (*Mount, error)

Mounted mounts the fuse.Server at a temporary directory.

It also waits until the filesystem is known to be visible (OS X workaround).

After successful return, caller must clean up by calling Close.

func MountedT

func MountedT(t testing.TB, filesys fs.FS) (*Mount, error)

MountedT mounts the filesystem at a temporary directory, directing it's debug log to the testing logger.

See Mounted for usage.

The debug log is not enabled by default. Use `-fuse.debug` or call DebugByDefault to enable.

func (*Mount) Close

func (mnt *Mount) Close()

Close unmounts the filesystem and waits for fs.Serve to return. Any returned error will be stored in Err. It is safe to call Close multiple times.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL