From e9c7e373e982d132f8651c3459d33625086f72ee Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 5 May 2023 21:02:35 +0000 Subject: [PATCH] feat(bsr/fstest): Implement Open method --- internal/bsr/internal/fstest/fs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/bsr/internal/fstest/fs.go b/internal/bsr/internal/fstest/fs.go index 12c9f084e..b209cead8 100644 --- a/internal/bsr/internal/fstest/fs.go +++ b/internal/bsr/internal/fstest/fs.go @@ -56,6 +56,19 @@ func (m *MemFS) New(ctx context.Context, n string) (storage.Container, error) { return c, nil } +// Open opens an existing a storage.Container from the MemFS. +func (m *MemFS) Open(_ context.Context, n string) (storage.Container, error) { + if m.Containers == nil { + return nil, fmt.Errorf("container %s not found", n) + } + + c, ok := m.Containers[n] + if !ok { + return nil, fmt.Errorf("container %s not found", n) + } + return c, nil +} + // MemContainer is a storage.Container that resides in memory. type MemContainer struct { Name string