Skip to content

Commit

Permalink
Add test for ProcessorFactory
Browse files Browse the repository at this point in the history
Signed-off-by: Davit Yeghshatyan <[email protected]>
  • Loading branch information
Davit Yeghshatyan committed Jul 23, 2018
1 parent d0a7e7e commit 3c0c2ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion cmd/ingester/app/consumer/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func TestConstructor(t *testing.T) {
newConsumer, err := New(params)
assert.NoError(t, err)
assert.NotNil(t, newConsumer)
assert.NotNil(t, newConsumer.processorFactory)

params.Builder = &mockConsumerConfiguration{
err: errors.New("consumerBuilder error"),
Expand Down
4 changes: 2 additions & 2 deletions cmd/ingester/app/consumer/processor_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ type ProcessorFactory struct {
}

// NewFactory constructs a new ProcessorFactory
func (c *ProcessorFactory) NewFactory(params FactoryParams) *ProcessorFactory {
func NewFactory(params FactoryParams) (*ProcessorFactory, error) {
return &ProcessorFactory{
topic: params.Topic,
consumer: params.Consumer,
metricsFactory: params.Factory,
logger: params.Logger,
baseProcessor: params.BaseProcessor,
parallelism: params.Parallelism,
}
}, nil
}

func (c *ProcessorFactory) new(partition int32, minOffset int64) processor.SpanProcessor {
Expand Down
7 changes: 7 additions & 0 deletions cmd/ingester/app/consumer/processor_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ import (
"github.com/jaegertracing/jaeger/cmd/ingester/app/processor/mocks"
)

func Test_NewFactory(t *testing.T) {
params := FactoryParams{}
newFactory, err := NewFactory(params)
assert.NoError(t, err)
assert.NotNil(t, newFactory)
}

func Test_new(t *testing.T) {

mockConsumer := &kmocks.Consumer{}
Expand Down

0 comments on commit 3c0c2ed

Please sign in to comment.