func NewTestDataContainer(relativeTestDataDir string, expectedMinFileCount int) (*TestDataContainer, error) { fullTestDataDir, err := filepath.Abs(relativeTestDataDir) if err != nil { return nil, err } testDataBaseFs := afero.NewBasePathFs(afero.NewOsFs(), fullTestDataDir) if err != nil { return nil, err } //These are relative paths because we are using "Base Path FS" relativeAllPaths, relativeDirs, relativeFiles, err := listPathsInFsDir(testDataBaseFs, "") if err != nil { return nil, err } if len(relativeFiles) < expectedMinFileCount { return nil, fmt.Errorf("Expects at least %d files in dir '%s'", expectedMinFileCount, fullTestDataDir) } return &TestDataContainer{ FullDir: fullTestDataDir, TestDataBaseFs: testDataBaseFs, RelativeAllPaths: relativeAllPaths, RelativeDirs: relativeDirs, RelativeFiles: relativeFiles, }, nil }
func NewTestingRemoteFileSystem() *RemoteFileSystem { // TODO: Make it more obvious that this directory is "populated" with the server which might be another machine // but for tests we plan to make the server startup locally on a different port so we can interact with it return &RemoteFileSystem{ Fs: afero.NewOsFs(), } }