Fix a panic in the indexer service test. (#7424)

The test service was starting up without a logger and crashing
while trying to log.
This commit is contained in:
M. J. Fromberger
2021-12-10 10:03:42 -08:00
committed by GitHub
parent 3e92899bd9
commit a925f4fa84
2 changed files with 6 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ Special thanks to external contributors on this release:
- [blocksync] \#7046 Remove v2 implementation of the blocksync service and recactor, which was disabled in the previous release. (@tychoish)
- [p2p] \#7064 Remove WDRR queue implementation. (@tychoish)
- [config] \#7169 `WriteConfigFile` now returns an error. (@tychoish)
- [libs/service] \#7288 Remove SetLogger method on `service.Service` interface. (@tychosih)
- [libs/service] \#7288 Remove SetLogger method on `service.Service` interface. (@tychoish)
- Blockchain Protocol

View File

@@ -39,14 +39,6 @@ var (
dbName = "postgres"
)
// NewIndexerService returns a new service instance.
func NewIndexerService(es []indexer.EventSink, eventBus *eventbus.EventBus) *indexer.Service {
return indexer.NewService(indexer.ServiceArgs{
Sinks: es,
EventBus: eventBus,
})
}
func TestIndexerServiceIndexesBlocks(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -70,7 +62,11 @@ func TestIndexerServiceIndexesBlocks(t *testing.T) {
assert.True(t, indexer.KVSinkEnabled(eventSinks))
assert.True(t, indexer.IndexingEnabled(eventSinks))
service := NewIndexerService(eventSinks, eventBus)
service := indexer.NewService(indexer.ServiceArgs{
Logger: logger,
Sinks: eventSinks,
EventBus: eventBus,
})
require.NoError(t, service.Start(ctx))
t.Cleanup(service.Wait)