Skip to content

Commit

Permalink
Add Unit Tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 committed Dec 6, 2024
1 parent 1ce9ffe commit 81010bf
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions storage_v2/factoryadapter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/jaegertracing/jaeger/plugin/storage/grpc"
dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks"
factoryMocks "github.com/jaegertracing/jaeger/storage/mocks"
spanstoreMocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks"
)
Expand Down Expand Up @@ -69,3 +70,23 @@ func TestAdapterCreateTraceWriter(t *testing.T) {
_, err := f.CreateTraceWriter()
require.NoError(t, err)
}

func TestAdapterCreateDependencyReader(t *testing.T) {
f1 := new(factoryMocks.Factory)
f1.On("CreateDependencyReader").Return(new(dependencyStoreMocks.Reader), nil)

f := NewFactory(f1)
r, err := f.CreateDependencyReader()
require.NoError(t, err)
require.NotNil(t, r)
}

func TestAdapterCreateDependencyReaderError(t *testing.T) {
f1 := new(factoryMocks.Factory)
testErr := errors.New("test error")
f1.On("CreateDependencyReader").Return(nil, testErr)

f := NewFactory(f1)
_, err := f.CreateDependencyReader()
require.ErrorIs(t, err, testErr)
}

0 comments on commit 81010bf

Please sign in to comment.