go-storage
go-storage copied to clipboard
test: `TestListEmptyDir` expected behavior does not apply to some file hosting service
https://github.com/beyondstorage/go-storage/blob/813c8a192cfc9f43eac39d66a910cf8d6512b7ec/tests/storager_list.go#L86-L96
path
is currently a non-existent path for the service. When listing a non-existent dir:
- For object storage services,
ListObjects
will get an emptyContents
inListBucketResult
, in line with the expected behavior. - For
fs
, althoughlist
does not return an error, we will getno such file or directory
error when callingNext()
. - For
dropbox
:ListFolder
will returnpath/not_found/...
error.
Maybe TestListEmptyDir
should list an existing empty dir?
How about CreateDir(path)
before List
? But the service should support CreateDir
feature. I'm not sure it's appropriate to check s.p.store.Features().CreateDir
in TestListEmptyDir
. If we judge in TestList
, all of test cases for List
may not be executed.
After adding CreateDir(path)
before List
, file hosting services basically passes the test now, but the object storage services no longer passes the test:
-
TestListEmptyDir
will get the objectworkdir/path/
with size 0 ins3
andcos
, maybe more services. -
TestListEmptyDir
test case will be passed when testing services3
withminio
.