Improve fs package and doc in prep to officially go public

This commit is contained in:
Jeffrey Regan
2019-10-01 10:38:00 -07:00
parent 07634ef098
commit 9a94bcb854
22 changed files with 256 additions and 364 deletions

View File

@@ -57,7 +57,7 @@ var testCases = []testData{
}
func MakeFakeFs(td []testData) fs.FileSystem {
fSys := fs.MakeFakeFS()
fSys := fs.MakeFsInMemory()
for _, x := range td {
fSys.WriteFile("/"+x.path, []byte(x.expectedContent))
}
@@ -230,7 +230,7 @@ func commonSetupForLoaderRestrictionTest() (string, fs.FileSystem, error) {
if err != nil {
return "", nil, err
}
fSys := fs.MakeRealFS()
fSys := fs.MakeFsOnDisk()
fSys.Mkdir(filepath.Join(dir, "base"))
fSys.WriteFile(
@@ -385,7 +385,7 @@ func TestNewLoaderAtGitClone(t *testing.T) {
pathInRepo := "foo/base"
url := rootUrl + "/" + pathInRepo
coRoot := "/tmp"
fSys := fs.MakeFakeFS()
fSys := fs.MakeFsInMemory()
fSys.MkdirAll(coRoot)
fSys.MkdirAll(coRoot + "/" + pathInRepo)
fSys.WriteFile(
@@ -432,7 +432,7 @@ func TestLoaderDisallowsLocalBaseFromRemoteOverlay(t *testing.T) {
// Define an overlay-base structure in the file system.
topDir := "/whatever"
cloneRoot := topDir + "/someClone"
fSys := fs.MakeFakeFS()
fSys := fs.MakeFsInMemory()
fSys.MkdirAll(topDir + "/highBase")
fSys.MkdirAll(cloneRoot + "/foo/base")
fSys.MkdirAll(cloneRoot + "/foo/overlay")
@@ -508,7 +508,7 @@ func TestLoaderDisallowsLocalBaseFromRemoteOverlay(t *testing.T) {
func TestLocalLoaderReferencingGitBase(t *testing.T) {
topDir := "/whatever"
cloneRoot := topDir + "/someClone"
fSys := fs.MakeFakeFS()
fSys := fs.MakeFsInMemory()
fSys.MkdirAll(topDir)
fSys.MkdirAll(cloneRoot + "/foo/base")
@@ -534,7 +534,7 @@ func TestLocalLoaderReferencingGitBase(t *testing.T) {
func TestRepoDirectCycleDetection(t *testing.T) {
topDir := "/cycles"
cloneRoot := topDir + "/someClone"
fSys := fs.MakeFakeFS()
fSys := fs.MakeFsInMemory()
fSys.MkdirAll(topDir)
fSys.MkdirAll(cloneRoot)
@@ -563,7 +563,7 @@ func TestRepoDirectCycleDetection(t *testing.T) {
func TestRepoIndirectCycleDetection(t *testing.T) {
topDir := "/cycles"
cloneRoot := topDir + "/someClone"
fSys := fs.MakeFakeFS()
fSys := fs.MakeFsInMemory()
fSys.MkdirAll(topDir)
fSys.MkdirAll(cloneRoot)