|
|
|
@ -152,7 +152,7 @@ func runTests(createCases func() []fsTestCase, t *testing.T) { |
|
|
|
|
|
|
|
|
|
func TestFsStorage(t *testing.T) { |
|
|
|
|
//skipTest := true
|
|
|
|
|
emptyFileBytes := make([]byte, 0) |
|
|
|
|
emptyContents := make([]byte, 0) |
|
|
|
|
pngImage, _ := base64.StdEncoding.DecodeString(pngImageBase64) |
|
|
|
|
pngImageSize := int64(len(pngImage)) |
|
|
|
|
|
|
|
|
@ -164,21 +164,21 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/folder2/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"prop1": "val1", "prop2": "val"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/file-inner.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"prop1": "val1", "prop2": "val"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/file-inner2.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFiles{ |
|
|
|
@ -261,25 +261,25 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/ab/a.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/ab/a/a.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/ac/a.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/aba/a.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFiles{ |
|
|
|
@ -307,14 +307,14 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/folder2/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"prop1": "val1", "prop2": "val"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/file-inner.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"prop1": "val1"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -370,13 +370,13 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/folder2/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/file-inner.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFiles{ |
|
|
|
@ -411,19 +411,19 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/a", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/b", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder2/c", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFiles{ |
|
|
|
@ -533,25 +533,25 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/folder2/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/file-inner.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folderX/folderZ/file.txt", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folderA/folderB/file.txt", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFolders{ |
|
|
|
@ -585,25 +585,25 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/folder2/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder1/file-inner.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folderX/folderZ/file.txt", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folderA/folderB/file.txt", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFolders{ |
|
|
|
@ -673,7 +673,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder/a.png", |
|
|
|
|
Contents: &pngImage, |
|
|
|
|
Contents: pngImage, |
|
|
|
|
Properties: map[string]string{"prop1": "val1", "prop2": "val"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -698,7 +698,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/Folder/A.png", |
|
|
|
|
Contents: &emptyFileBytes, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryGet{ |
|
|
|
@ -718,7 +718,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/a.png", |
|
|
|
|
Contents: &pngImage, |
|
|
|
|
Contents: pngImage, |
|
|
|
|
Properties: map[string]string{"a": "av", "b": "bv"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -754,7 +754,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/aB.png", |
|
|
|
|
Contents: &emptyFileBytes, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"a": "av", "b": "bv"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -791,7 +791,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/FILE.png", |
|
|
|
|
Contents: &emptyFileBytes, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"a": "av", "b": "bv"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -803,13 +803,13 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
fName("FILE.png"), |
|
|
|
|
fProperties(map[string]string{"a": "av", "b": "bv"}), |
|
|
|
|
fSize(0), |
|
|
|
|
fContents(emptyFileBytes), |
|
|
|
|
fContents(emptyContents), |
|
|
|
|
), |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/file.png", |
|
|
|
|
Contents: &pngImage, |
|
|
|
|
Contents: pngImage, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryGet{ |
|
|
|
@ -832,7 +832,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/FILE.png", |
|
|
|
|
Contents: &emptyFileBytes, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"a": "av", "b": "bv"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -855,7 +855,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/file.png", |
|
|
|
|
Contents: &emptyFileBytes, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
Properties: map[string]string{"a": "av", "b": "bv"}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -888,7 +888,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/aB/cD/eF/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFolders{ |
|
|
|
@ -1007,7 +1007,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/a/b/c/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFolders{ |
|
|
|
@ -1119,7 +1119,7 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/folder/dashboards/myNewFolder/file.jpg", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdDeleteFolder{ |
|
|
|
@ -1164,43 +1164,43 @@ func TestFsStorage(t *testing.T) { |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/s3/folder/dashboard.json", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/s3/folder/nested/dashboard.json", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/gitA/dashboard1.json", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/gitA/dashboard2.json", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/gitB/nested/dashboard.json", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/gitB/nested2/dashboard2.json", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
cmdUpsert{ |
|
|
|
|
cmd: UpsertFileCommand{ |
|
|
|
|
Path: "/gitC/nestedC/dashboardC.json", |
|
|
|
|
Contents: &[]byte{}, |
|
|
|
|
Contents: emptyContents, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
queryListFiles{ |
|
|
|
|