From 5c2bc72151107648b222feb0ab71474641cec9bd Mon Sep 17 00:00:00 2001 From: JinnyYi Date: Thu, 18 Nov 2021 16:57:14 +0800 Subject: [PATCH 1/2] fix(tests): Create an empty dir for TestListEmptyDir --- tests/storager_list.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/storager_list.go b/tests/storager_list.go index 513e9e5ba..8f9765f00 100644 --- a/tests/storager_list.go +++ b/tests/storager_list.go @@ -84,8 +84,16 @@ func (s *storageListSuite) TestListWithoutListMode() { } func (s *storageListSuite) TestListEmptyDir() { + if !s.p.store.Features().CreateDir { + s.T().Skipf("store doesn't support CreateDir, skip TestListEmptyDir.") + } + path := uuid.New().String() + _, err := s.p.store.CreateDir(path) + s.NoError(err) + defer s.p.store.Delete(path, ps.WithObjectMode(types.ModeDir)) + it, err := s.p.store.List(path, ps.WithListMode(types.ListModeDir)) s.NoError(err) s.NotNil(it) From 711ce79660702fb690d5b1c9e56a7396f3b856ef Mon Sep 17 00:00:00 2001 From: JinnyYi Date: Thu, 18 Nov 2021 17:13:29 +0800 Subject: [PATCH 2/2] Check the return value of Delete --- tests/storager_list.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/storager_list.go b/tests/storager_list.go index 8f9765f00..1d253c6b0 100644 --- a/tests/storager_list.go +++ b/tests/storager_list.go @@ -92,7 +92,11 @@ func (s *storageListSuite) TestListEmptyDir() { _, err := s.p.store.CreateDir(path) s.NoError(err) - defer s.p.store.Delete(path, ps.WithObjectMode(types.ModeDir)) + + defer func() { + err = s.p.store.Delete(path, ps.WithObjectMode(types.ModeDir)) + s.NoError(err) + }() it, err := s.p.store.List(path, ps.WithListMode(types.ListModeDir)) s.NoError(err)