Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: TestListEmptyDir expected behavior does not apply to some file hosting service #1034

Open
JinnyYi opened this issue Nov 18, 2021 · 2 comments · Fixed by #1036
Open

Comments

@JinnyYi
Copy link
Contributor

JinnyYi commented Nov 18, 2021

func (s *storageListSuite) TestListEmptyDir() {
path := uuid.New().String()
it, err := s.p.store.List(path, ps.WithListMode(types.ListModeDir))
s.NoError(err)
s.NotNil(it)
o, err := it.Next()
s.ErrorIs(err, types.IterateDone)
s.Nil(o)
}

path is currently a non-existent path for the service. When listing a non-existent dir:

  • For object storage services, ListObjects will get an empty Contents in ListBucketResult, in line with the expected behavior.
  • For fs, although list does not return an error, we will get no such file or directory error when calling Next().
  • For dropbox: ListFolder will return path/not_found/... error.
@JinnyYi
Copy link
Contributor Author

JinnyYi commented Nov 18, 2021

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.

@JinnyYi
Copy link
Contributor Author

JinnyYi commented Nov 23, 2021

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 object workdir/path/ with size 0 in s3 and cos, maybe more services.
  • TestListEmptyDir test case will be passed when testing service s3 with minio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant