Git Product home page Git Product logo

testfs's Introduction

TestFS

TestFS implements a full POSIX filesystem in memory in Go, similar to a basix Linux/UNIX filesystem.

It's designed primarily for running detailed tests, and as such it also provides OSFS which wraps the normal core "os" commands.

All syntax and functionality should be identical to the core "os" package.

To use this in your projects, create a Filesystem variable, and use either NewOSFS or NewTestFS to use either the normal on-disk filesystem or the in-memory TestFS filesystem. NewTestFs takes two parameters, the root UID and GID. To use the current user, there's a helper function: NewLocalTestFS.

Stability

Current status of the code is first alpha, at best. There may well be bugs. However, the interface is set in stone, as it is designed to exactly match the core "os" package. Any behaviour that doesn't match "os" is a bug, and will be fixed.

Performance

It's entirely in RAM, so general IO performance is excellent. However, making this behave like a real POSIX filesystem introduces a bunch of overheads in areas like directory creation and traversal, for example. A well implemented key/value store will be considerably faster, albeit with far fewer features.

Can it do XYZ?

If XYZ is a common feature of POSIX filesystems, yes. This supports xattrs (with no space limit), so testing selinux contexts etc should all be fine.

You cannot, however, use this to run external applications in memory without modifying the application to link against TestFS.

testfs's People

Contributors

jfindley avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.