From 9ce6576b857b9e16de603dbaa06ed0a21b23625c Mon Sep 17 00:00:00 2001 From: Mahad Zaryab Date: Fri, 6 Dec 2024 17:11:28 -0500 Subject: [PATCH] Update Factory To Use New Reader Wrapper Signed-off-by: Mahad Zaryab --- storage_v2/factoryadapter/factory.go | 6 +++++- storage_v2/factoryadapter/factory_test.go | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/storage_v2/factoryadapter/factory.go b/storage_v2/factoryadapter/factory.go index 04e7658f1b8..1eaaea146ed 100644 --- a/storage_v2/factoryadapter/factory.go +++ b/storage_v2/factoryadapter/factory.go @@ -55,5 +55,9 @@ func (f *Factory) CreateTraceWriter() (tracestore.Writer, error) { // CreateDependencyReader implements depstore.Factory. func (f *Factory) CreateDependencyReader() (depstore.Reader, error) { - return f.ss.CreateDependencyReader() + dr, err := f.ss.CreateDependencyReader() + if err != nil { + return nil, err + } + return NewDependencyReader(dr), nil } diff --git a/storage_v2/factoryadapter/factory_test.go b/storage_v2/factoryadapter/factory_test.go index 487fa535966..b8ccb5fb173 100644 --- a/storage_v2/factoryadapter/factory_test.go +++ b/storage_v2/factoryadapter/factory_test.go @@ -87,6 +87,7 @@ func TestAdapterCreateDependencyReaderError(t *testing.T) { f1.On("CreateDependencyReader").Return(nil, testErr) f := NewFactory(f1) - _, err := f.CreateDependencyReader() + r, err := f.CreateDependencyReader() require.ErrorIs(t, err, testErr) + require.Nil(t, r) }