Documentation
¶
Index ¶
- Variables
- type CountingFS
- func (fs *CountingFS) Create(name string) (afero.File, error)
- func (fs *CountingFS) GetCounts() (opened, closed int)
- func (fs *CountingFS) Open(name string) (afero.File, error)
- func (fs *CountingFS) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (fs *CountingFS) Unclosed() int
- type FailingFS
- type FailingFile
Constants ¶
This section is empty.
Variables ¶
var (
ErrTestFileReadInterrupted = errors.New("test file read interrupted")
)
Functions ¶
This section is empty.
Types ¶
type CountingFS ¶
CountingFS wraps an afero filesystem and counts the files opened and closed through it
func NewCountingFS ¶
func NewCountingFS(fs afero.Fs) *CountingFS
func (*CountingFS) Create ¶
func (fs *CountingFS) Create(name string) (afero.File, error)
Create creates a file and counts it
func (*CountingFS) GetCounts ¶
func (fs *CountingFS) GetCounts() (opened, closed int)
GetCounts returns how many files were opened and closed. A file closed more than once counts once, so equal counts mean every file was closed
func (*CountingFS) Open ¶
func (fs *CountingFS) Open(name string) (afero.File, error)
Open opens a file and counts it
func (*CountingFS) Unclosed ¶
func (fs *CountingFS) Unclosed() int
Unclosed returns how many files are still open
type FailingFS ¶
FailingFS is an afero.Fs that returns ErrTestFileReadInterrupted when the file at failPath is read, after failAfter bytes have been read from that file. Reads all other files normally.