@ -21,7 +21,7 @@ const (
type fsTestCase struct {
name string
skip * bool
steps [ ] interface { }
steps [ ] any
}
func runTestCase ( t * testing . T , testCase fsTestCase , ctx context . Context , filestorage FileStorage ) {
@ -186,7 +186,7 @@ func TestIntegrationFsStorage(t *testing.T) {
return [ ] fsTestCase {
{
name : "listing files" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/folder1/folder2/file.jpg" ,
@ -210,7 +210,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : true } } ,
list : checks ( listSize ( 3 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2/file.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/file-inner.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
checks ( fPath ( "/folder1/file-inner2.jpg" ) , fProperties ( map [ string ] string { } ) ) ,
checks ( fPath ( "/folder1/folder2/file.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
@ -219,7 +219,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true } } ,
list : checks ( listSize ( 4 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2/file.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/file-inner.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
checks ( fPath ( "/folder1/file-inner2.jpg" ) , fProperties ( map [ string ] string { } ) ) ,
checks ( fPath ( "/folder1/folder2" ) , fProperties ( map [ string ] string { } ) , fMimeType ( DirectoryMimeType ) ) ,
@ -229,19 +229,19 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : false } } ,
list : checks ( listSize ( 0 ) , listHasMore ( false ) , listLastPath ( "" ) ) ,
files : [ ] [ ] interface { } { } ,
files : [ ] [ ] any { } ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : false , WithFolders : true , WithFiles : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1" ) , fProperties ( map [ string ] string { } ) , fMimeType ( DirectoryMimeType ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : false } } ,
list : checks ( listSize ( 2 ) , listHasMore ( false ) , listLastPath ( "/folder1/file-inner2.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/file-inner.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
checks ( fPath ( "/folder1/file-inner2.jpg" ) , fProperties ( map [ string ] string { } ) ) ,
} ,
@ -249,7 +249,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : false , WithFolders : true , WithFiles : true } } ,
list : checks ( listSize ( 3 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/file-inner.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
checks ( fPath ( "/folder1/file-inner2.jpg" ) , fProperties ( map [ string ] string { } ) ) ,
checks ( fPath ( "/folder1/folder2" ) , fProperties ( map [ string ] string { } ) , fMimeType ( DirectoryMimeType ) ) ,
@ -258,32 +258,32 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/folder1/folder2" , options : & ListOptions { Recursive : false } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2/file.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2/file.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1/folder2" , options : & ListOptions { Recursive : false , WithFolders : true , WithFiles : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2/file.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2/file.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1/folder2" , options : & ListOptions { Recursive : false } , paging : & Paging { After : "/folder1/folder2/file.jpg" } } ,
list : checks ( listSize ( 0 ) , listHasMore ( false ) , listLastPath ( "" ) ) ,
files : [ ] [ ] interface { } { } ,
files : [ ] [ ] any { } ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1/folder2" , options : & ListOptions { Recursive : false , WithFolders : true , WithFiles : true } , paging : & Paging { After : "/folder1/folder2/file.jpg" } } ,
list : checks ( listSize ( 0 ) , listHasMore ( false ) , listLastPath ( "" ) ) ,
files : [ ] [ ] interface { } { } ,
files : [ ] [ ] any { } ,
} ,
} ,
} ,
{
name : "path passed to listing files is a folder path, not a prefix" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/ab/a.jpg" ,
@ -311,7 +311,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/ab" , options : & ListOptions { Recursive : true } } ,
list : checks ( listSize ( 2 ) , listHasMore ( false ) , listLastPath ( "/ab/a/a.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/ab/a.jpg" ) ) ,
checks ( fPath ( "/ab/a/a.jpg" ) ) ,
} ,
@ -319,7 +319,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/ab" , options : & ListOptions { Recursive : true , WithFolders : true , WithFiles : true } } ,
list : checks ( listSize ( 3 ) , listHasMore ( false ) , listLastPath ( "/ab/a/a.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/ab/a.jpg" ) ) ,
checks ( fPath ( "/ab/a" ) , fMimeType ( DirectoryMimeType ) ) ,
checks ( fPath ( "/ab/a/a.jpg" ) ) ,
@ -329,7 +329,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "listing files with path to a file" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/folder1/folder2/file.jpg" ,
@ -370,35 +370,35 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/folder1/folder2/file.jpg" , options : & ListOptions { Recursive : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2/file.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2/file.jpg" ) , fName ( "file.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1/folder2/file.jpg" , options : & ListOptions { Recursive : true , WithFolders : true , WithFiles : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2/file.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2/file.jpg" ) , fName ( "file.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" , "prop2" : "val" } ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1/file-inner.jpg" , options : & ListOptions { Recursive : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1/file-inner.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/file-inner.jpg" ) , fName ( "file-inner.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" } ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/dashboards/dashboards/file-inner.jpg" , options : & ListOptions { Recursive : true , WithFiles : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/dashboards/dashboards/file-inner.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/dashboards/dashboards/file-inner.jpg" ) , fName ( "file-inner.jpg" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1/file-inner.jpg" , options : & ListOptions { Recursive : true , WithFolders : true , WithFiles : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1/file-inner.jpg" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/file-inner.jpg" ) , fName ( "file-inner.jpg" ) , fProperties ( map [ string ] string { "prop1" : "val1" } ) ) ,
} ,
} ,
@ -406,7 +406,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "listing files with prefix filter" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/folder1/folder2/file.jpg" ,
@ -426,19 +426,19 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true , Filter : NewPathFilter ( [ ] string { "/folder2" } , nil , nil , nil ) } } ,
list : checks ( listSize ( 0 ) , listHasMore ( false ) , listLastPath ( "" ) ) ,
files : [ ] [ ] interface { } { } ,
files : [ ] [ ] any { } ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : true , Filter : NewPathFilter ( [ ] string { "/folder1/folder" } , nil , nil , nil ) } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2/file.jpg" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true , Filter : NewPathFilter ( [ ] string { "/folder1/folder" } , nil , nil , nil ) } } ,
list : checks ( listSize ( 2 ) , listHasMore ( false ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2" ) , fMimeType ( "directory" ) ) ,
checks ( fPath ( "/folder1/folder2/file.jpg" ) ) ,
} ,
@ -447,7 +447,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "listing files with pagination" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/folder1/a" ,
@ -469,7 +469,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true } , paging : & Paging { First : 2 , After : "" } } ,
list : checks ( listSize ( 2 ) , listHasMore ( true ) , listLastPath ( "/folder1/b" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/a" ) ) ,
checks ( fPath ( "/folder1/b" ) ) ,
} ,
@ -477,7 +477,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true } , paging : & Paging { First : 2 , After : "" } } ,
list : checks ( listSize ( 2 ) , listHasMore ( true ) , listLastPath ( "/folder1/a" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1" ) , fMimeType ( DirectoryMimeType ) ) ,
checks ( fPath ( "/folder1/a" ) ) ,
} ,
@ -485,49 +485,49 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true } , paging : & Paging { First : 1 , After : "/folder1" } } ,
list : checks ( listSize ( 1 ) , listHasMore ( true ) , listLastPath ( "/folder1/a" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/a" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true } , paging : & Paging { First : 1 , After : "/folder1/a" } } ,
list : checks ( listSize ( 1 ) , listHasMore ( true ) , listLastPath ( "/folder1/b" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/b" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true } , paging : & Paging { First : 1 , After : "/folder1/a" } } ,
list : checks ( listSize ( 1 ) , listHasMore ( true ) , listLastPath ( "/folder1/b" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/b" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true } , paging : & Paging { First : 1 , After : "/folder1/b" } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder2/c" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder2/c" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true } , paging : & Paging { First : 1 , After : "/folder1/b" } } ,
list : checks ( listSize ( 1 ) , listHasMore ( true ) , listLastPath ( "/folder2" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder2" ) , fMimeType ( DirectoryMimeType ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true } , paging : & Paging { First : 1 , After : "/folder2" } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder2/c" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder2/c" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true } , paging : & Paging { First : 5 , After : "" } } ,
list : checks ( listSize ( 3 ) , listHasMore ( false ) , listLastPath ( "/folder2/c" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/a" ) ) ,
checks ( fPath ( "/folder1/b" ) ) ,
checks ( fPath ( "/folder2/c" ) ) ,
@ -536,7 +536,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true , WithFiles : true , WithFolders : true } , paging : & Paging { First : 5 , After : "" } } ,
list : checks ( listSize ( 5 ) , listHasMore ( false ) , listLastPath ( "/folder2/c" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1" ) , fMimeType ( DirectoryMimeType ) ) ,
checks ( fPath ( "/folder1/a" ) ) ,
checks ( fPath ( "/folder1/b" ) ) ,
@ -569,7 +569,7 @@ func TestIntegrationFsStorage(t *testing.T) {
return [ ] fsTestCase {
{
name : "listing folders" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/folder1/folder2/file.jpg" ,
@ -596,7 +596,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : true } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder1" ) ) ,
checks ( fPath ( "/folder1/folder2" ) ) ,
checks ( fPath ( "/folderA" ) ) ,
@ -608,7 +608,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : true , WithFiles : false , WithFolders : true } } ,
list : checks ( listSize ( 6 ) , listHasMore ( false ) , listLastPath ( "/folderX/folderZ" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1" ) , fMimeType ( DirectoryMimeType ) ) ,
checks ( fPath ( "/folder1/folder2" ) , fMimeType ( DirectoryMimeType ) ) ,
checks ( fPath ( "/folderA" ) , fMimeType ( DirectoryMimeType ) ) ,
@ -621,7 +621,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "listing folders non recursively" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/folder1/folder2/file.jpg" ,
@ -648,34 +648,34 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
queryListFolders {
input : queryListFoldersInput { path : "/folder1" , options : & ListOptions { Recursive : false } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2" ) ) ,
} ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1" , options : & ListOptions { Recursive : false , WithFiles : false , WithFolders : true } } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/folder1/folder2" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1/folder2" ) , fMimeType ( DirectoryMimeType ) ) ,
} ,
} ,
queryListFolders {
input : queryListFoldersInput { path : "/folderZ" , options : & ListOptions { Recursive : false } } ,
checks : [ ] [ ] interface { } { } ,
checks : [ ] [ ] any { } ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folderZ" , options : & ListOptions { Recursive : false , WithFiles : false , WithFolders : true } } ,
list : checks ( listSize ( 0 ) , listHasMore ( false ) , listLastPath ( "" ) ) ,
files : [ ] [ ] interface { } { } ,
files : [ ] [ ] any { } ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/folder1/folder2" , options : & ListOptions { Recursive : false , WithFiles : false , WithFolders : true } } ,
list : checks ( listSize ( 0 ) , listHasMore ( false ) , listLastPath ( "" ) ) ,
files : [ ] [ ] interface { } { } ,
files : [ ] [ ] any { } ,
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : false } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder1" ) ) ,
checks ( fPath ( "/folderA" ) ) ,
checks ( fPath ( "/folderX" ) ) ,
@ -684,7 +684,7 @@ func TestIntegrationFsStorage(t *testing.T) {
queryListFiles {
input : queryListFilesInput { path : "/" , options : & ListOptions { Recursive : false , WithFiles : false , WithFolders : true } } ,
list : checks ( listSize ( 3 ) , listHasMore ( false ) , listLastPath ( "/folderX" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/folder1" ) , fMimeType ( DirectoryMimeType ) ) ,
checks ( fPath ( "/folderA" ) , fMimeType ( DirectoryMimeType ) ) ,
checks ( fPath ( "/folderX" ) , fMimeType ( DirectoryMimeType ) ) ,
@ -699,7 +699,7 @@ func TestIntegrationFsStorage(t *testing.T) {
return [ ] fsTestCase {
{
name : "getting a non-existent file" ,
steps : [ ] interface { } {
steps : [ ] any {
queryGet {
input : queryGetInput {
path : "/folder/a.png" ,
@ -709,7 +709,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "inserting a file" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/folder/a.png" ,
@ -734,7 +734,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "preserved original path/name casing when getting a file" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/Folder/A.png" ,
@ -754,7 +754,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "modifying file metadata" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/a.png" ,
@ -790,7 +790,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "modifying file metadata preserves original path casing" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/aB.png" ,
@ -827,7 +827,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "modifying file contents" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/FILE.png" ,
@ -881,7 +881,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "deleting a file" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/FILE.png" ,
@ -924,7 +924,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "deleting a non-existent file should be no-op" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdDelete {
path : "/file.png" ,
} ,
@ -937,7 +937,7 @@ func TestIntegrationFsStorage(t *testing.T) {
return [ ] fsTestCase {
{
name : "recreating a folder after it was already created via upserting a file is a no-op" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/aB/cD/eF/file.jpg" ,
@ -948,7 +948,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/aB" ) ) ,
checks ( fPath ( "/aB/cD" ) ) ,
checks ( fPath ( "/aB/cD/eF" ) ) ,
@ -961,7 +961,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/aB" ) ) ,
checks ( fPath ( "/aB/cD" ) ) ,
checks ( fPath ( "/aB/cD/eF" ) ) ,
@ -974,7 +974,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/aB" ) ) ,
checks ( fPath ( "/aB/cD" ) ) ,
checks ( fPath ( "/aB/cD/eF" ) ) ,
@ -985,7 +985,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "creating a folder with the same name or same name but different casing is a no-op" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/aB" ,
} ,
@ -999,7 +999,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/aB" ) ) ,
} ,
} ,
@ -1010,7 +1010,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/aB" ) ) ,
} ,
} ,
@ -1018,7 +1018,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "creating folder is recursive" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/a/b/c" ,
} ,
@ -1026,7 +1026,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/a" ) ) ,
checks ( fPath ( "/a/b" ) ) ,
checks ( fPath ( "/a/b/c" ) ) ,
@ -1036,7 +1036,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "deleting a leaf directory does not delete parent directories even if they are empty - folders created directly" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/a/b/c" ,
} ,
@ -1047,7 +1047,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/a" ) ) ,
checks ( fPath ( "/a/b" ) ) ,
} ,
@ -1056,7 +1056,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "deleting a leaf directory does not delete parent directories even if they are empty - folders created via file upsert" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/a/b/c/file.jpg" ,
@ -1067,7 +1067,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/a" ) ) ,
checks ( fPath ( "/a/b" ) ) ,
checks ( fPath ( "/a/b/c" ) ) ,
@ -1081,7 +1081,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/a" ) ) ,
checks ( fPath ( "/a/b" ) ) ,
checks ( fPath ( "/a/b/c" ) ) ,
@ -1094,7 +1094,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/a" ) ) ,
checks ( fPath ( "/a/b" ) ) ,
} ,
@ -1103,7 +1103,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "folders preserve their original casing" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/aB/cD/e" ,
} ,
@ -1114,7 +1114,7 @@ func TestIntegrationFsStorage(t *testing.T) {
input : queryListFoldersInput {
path : "/" ,
} ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/aB" ) ) ,
checks ( fPath ( "/aB/cD" ) ) ,
checks ( fPath ( "/aB/cD/e" ) ) ,
@ -1125,13 +1125,13 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "folders can't be deleted through the `delete` method" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/folder/dashboards/myNewFolder" ,
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : true } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder" ) ) ,
checks ( fPath ( "/folder/dashboards" ) ) ,
checks ( fPath ( "/folder/dashboards/myNewFolder" ) ) ,
@ -1142,7 +1142,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : true } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder" ) ) ,
checks ( fPath ( "/folder/dashboards" ) ) ,
checks ( fPath ( "/folder/dashboards/myNewFolder" ) ) ,
@ -1152,7 +1152,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "folders can not be retrieved through the `get` method" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/folder/dashboards/myNewFolder" ,
} ,
@ -1165,7 +1165,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "should not be able to delete folders with files" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/folder/dashboards/myNewFolder" ,
} ,
@ -1179,12 +1179,12 @@ func TestIntegrationFsStorage(t *testing.T) {
path : "/folder/dashboards/myNewFolder" ,
error : & cmdErrorOutput {
message : "folder %s is not empty - cant remove it" ,
args : [ ] interface { } { "/folder/dashboards/myNewFolder" } ,
args : [ ] any { "/folder/dashboards/myNewFolder" } ,
} ,
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : true } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder" ) ) ,
checks ( fPath ( "/folder/dashboards" ) ) ,
checks ( fPath ( "/folder/dashboards/myNewFolder" ) ) ,
@ -1202,7 +1202,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "should be able to delete folders with files if using force" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/folder/dashboards/myNewFolder" ,
} ,
@ -1220,7 +1220,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : true } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder" ) ) ,
checks ( fPath ( "/folder/dashboards" ) ) ,
} ,
@ -1234,7 +1234,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "should be able to delete root folder with force" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/folder/dashboards/myNewFolder" ,
} ,
@ -1252,7 +1252,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : true } } ,
checks : [ ] [ ] interface { } { } ,
checks : [ ] [ ] any { } ,
} ,
queryGet {
input : queryGetInput {
@ -1263,7 +1263,7 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
{
name : "should not be able to delete a folder unless have access to all nested files" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdCreateFolder {
path : "/folder/dashboards/myNewFolder" ,
} ,
@ -1287,12 +1287,12 @@ func TestIntegrationFsStorage(t *testing.T) {
} ,
error : & cmdErrorOutput {
message : "force folder delete: unauthorized access for path %s" ,
args : [ ] interface { } { "/" } ,
args : [ ] any { "/" } ,
} ,
} ,
queryListFolders {
input : queryListFoldersInput { path : "/" , options : & ListOptions { Recursive : true } } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
checks ( fPath ( "/folder" ) ) ,
checks ( fPath ( "/folder/dashboards" ) ) ,
checks ( fPath ( "/folder/dashboards/abc" ) ) ,
@ -1330,7 +1330,7 @@ func TestIntegrationFsStorage(t *testing.T) {
return [ ] fsTestCase {
{
name : "catch-all test - TODO: split into multiple" ,
steps : [ ] interface { } {
steps : [ ] any {
cmdUpsert {
cmd : UpsertFileCommand {
Path : "/s3/folder/dashboard.json" ,
@ -1393,7 +1393,7 @@ func TestIntegrationFsStorage(t *testing.T) {
Filter : pathFilters ,
} } ,
list : checks ( listSize ( 5 ) , listHasMore ( false ) , listLastPath ( "/s3/folder/dashboard.json" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
// /gitA/dashboard.json is not explicitly allowed
checks ( fPath ( "/gitA/dashboard2.json" ) ) , // explicitly allowed by allowedPath
checks ( fPath ( "/gitB/nested/dashboard.json" ) ) , // allowed by '/gitB/' prefix
@ -1411,7 +1411,7 @@ func TestIntegrationFsStorage(t *testing.T) {
WithFolders : true ,
} } ,
list : checks ( listSize ( 10 ) , listHasMore ( false ) , listLastPath ( "/s3/folder/dashboard.json" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
// /gitA/dashboard.json is not explicitly allowed
checks ( fPath ( "/gitA/dashboard2.json" ) ) , // explicitly allowed by allowedPath
checks ( fPath ( "/gitB" ) ) , // allowed by '/gitB/' prefix
@ -1433,7 +1433,7 @@ func TestIntegrationFsStorage(t *testing.T) {
Recursive : true ,
Filter : pathFilters ,
} } ,
checks : [ ] [ ] interface { } {
checks : [ ] [ ] any {
// /gitA is missing due to the lack of explicit allow
checks ( fPath ( "/gitB" ) ) , // allowed by '/gitB/' prefix
checks ( fPath ( "/gitB/nested" ) ) , // allowed by '/gitB/' prefix
@ -1451,7 +1451,7 @@ func TestIntegrationFsStorage(t *testing.T) {
Filter : pathFilters ,
} } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/gitA/dashboard2.json" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/gitA/dashboard2.json" ) ) ,
} ,
} ,
@ -1460,7 +1460,7 @@ func TestIntegrationFsStorage(t *testing.T) {
Recursive : false ,
Filter : pathFilters ,
} } ,
checks : [ ] [ ] interface { } { } ,
checks : [ ] [ ] any { } ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/gitC" , options : & ListOptions {
@ -1468,7 +1468,7 @@ func TestIntegrationFsStorage(t *testing.T) {
Filter : pathFilters ,
} } ,
list : checks ( listSize ( 0 ) , listHasMore ( false ) , listLastPath ( "" ) ) ,
files : [ ] [ ] interface { } { } ,
files : [ ] [ ] any { } ,
} ,
queryListFiles {
input : queryListFilesInput { path : "/gitC/nestedC" , options : & ListOptions {
@ -1476,7 +1476,7 @@ func TestIntegrationFsStorage(t *testing.T) {
Filter : pathFilters ,
} } ,
list : checks ( listSize ( 1 ) , listHasMore ( false ) , listLastPath ( "/gitC/nestedC/dashboardC.json" ) ) ,
files : [ ] [ ] interface { } {
files : [ ] [ ] any {
checks ( fPath ( "/gitC/nestedC/dashboardC.json" ) ) ,
} ,
} ,
@ -1485,7 +1485,7 @@ func TestIntegrationFsStorage(t *testing.T) {
Recursive : false ,
Filter : pathFilters ,
} } ,
checks : [ ] [ ] interface { } { } ,
checks : [ ] [ ] any { } ,
} ,
} ,
} ,