Skip to content

Commit

Permalink
Merge pull request #679 from celestiaorg/tzdybal/fix_assertion
Browse files Browse the repository at this point in the history
refactor: GetSharesByNamespace - no error if namespace not found
  • Loading branch information
tzdybal committed May 6, 2022
2 parents 3035f66 + 0d58b3a commit 81b8f87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion service/share/share.go
Expand Up @@ -159,7 +159,7 @@ func (s *service) GetSharesByNamespace(ctx context.Context, root *Root, nID name
}
}
if len(rowRootCIDs) == 0 {
return nil, format.ErrNotFound
return nil, nil
}

errGroup, ctx := errgroup.WithContext(ctx)
Expand Down
4 changes: 2 additions & 2 deletions service/share/share_test.go
Expand Up @@ -108,13 +108,13 @@ func TestGetShares(t *testing.T) {
require.NoError(t, err)
}

func TestService_GetSharesByNamespaceNotFoundInRange(t *testing.T) {
func TestService_GetSharesByNamespaceNotFound(t *testing.T) {
serv, root := RandLightServiceWithSquare(t, 1)
root.RowsRoots = nil

shares, err := serv.GetSharesByNamespace(context.Background(), root, []byte(""))
assert.Len(t, shares, 0)
require.Error(t, err, "namespaceID not found in range")
assert.NoError(t, err)
}

func BenchmarkService_GetSharesByNamespace(b *testing.B) {
Expand Down

0 comments on commit 81b8f87

Please sign in to comment.