diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go index 6bc2eaa04ef..ffc3e2a31b1 100644 --- a/plugin/storage/grpc/factory_test.go +++ b/plugin/storage/grpc/factory_test.go @@ -47,13 +47,17 @@ func (b *mockPluginBuilder) Build() (*grpcConfig.ClientPluginServices, error) { return nil, b.err } - return &grpcConfig.ClientPluginServices{ + services := &grpcConfig.ClientPluginServices{ PluginServices: shared.PluginServices{ Store: b.plugin, ArchiveStore: b.plugin, }, - Capabilities: b.plugin, - }, nil + } + if b.plugin.capabilities != nil { + services.Capabilities = b.plugin + } + + return services, nil } type mockPlugin struct { @@ -215,6 +219,28 @@ func TestGRPCStorageFactory_CapabilitiesError(t *testing.T) { assert.Nil(t, writer) } +func TestGRPCStorageFactory_CapabilitiesNil(t *testing.T) { + f := NewFactory() + v := viper.New() + f.InitFromViper(v) + + f.builder = &mockPluginBuilder{ + plugin: &mockPlugin{ + archiveWriter: new(spanStoreMocks.Writer), + archiveReader: new(spanStoreMocks.Reader), + }, + } + assert.NoError(t, f.Initialize(metrics.NullFactory, zap.NewNop())) + + assert.NotNil(t, f.store) + reader, err := f.CreateArchiveSpanReader() + assert.Equal(t, err, storage.ErrArchiveStorageNotSupported) + assert.Nil(t, reader) + writer, err := f.CreateArchiveSpanWriter() + assert.Equal(t, err, storage.ErrArchiveStorageNotSupported) + assert.Nil(t, writer) +} + func TestWithConfiguration(t *testing.T) { f := NewFactory() v, command := config.Viperize(f.AddFlags)