Panic if connecting to geth subscription fails
This commit is contained in:
parent
0cc90a1f80
commit
9226e53e0b
@ -40,8 +40,8 @@ func (fetcher *GethRpcStorageFetcher) FetchStorageDiffs(out chan<- utils.Storage
|
||||
ethStatediffPayloadChan := fetcher.statediffPayloadChan
|
||||
clientSubscription, clientSubErr := fetcher.streamer.Stream(ethStatediffPayloadChan)
|
||||
if clientSubErr != nil {
|
||||
logrus.Warn("Error creating a geth client subscription: ", clientSubErr)
|
||||
errs <- clientSubErr
|
||||
panic(fmt.Sprintf("Error creating a geth client subscription: %v", clientSubErr))
|
||||
}
|
||||
logrus.Info("Successfully created a geth client subscription: ", clientSubscription)
|
||||
|
||||
|
@ -68,10 +68,15 @@ var _ = Describe("Geth RPC Storage Fetcher", func() {
|
||||
errorChan = make(chan error)
|
||||
})
|
||||
|
||||
It("adds errors to error channel if the RPC subscription fails ", func(done Done) {
|
||||
It("adds errors to error channel if the RPC subscription fails and panics", func(done Done) {
|
||||
streamer.SetSubscribeError(fakes.FakeError)
|
||||
|
||||
go statediffFetcher.FetchStorageDiffs(storagediffChan, errorChan)
|
||||
go func() {
|
||||
failedSub := func() {
|
||||
statediffFetcher.FetchStorageDiffs(storagediffChan, errorChan)
|
||||
}
|
||||
Expect(failedSub).To(Panic())
|
||||
}()
|
||||
|
||||
Expect(<-errorChan).To(MatchError(fakes.FakeError))
|
||||
close(done)
|
||||
|
@ -100,7 +100,6 @@ var _ = Describe("Geth Storage Watcher", func() {
|
||||
BeforeEach(func() {
|
||||
mockFetcher.DiffsToReturn = []utils.StorageDiff{gethDiff}
|
||||
storageWatcher = watcher.NewGethStorageWatcher(mockFetcher, test_config.NewTestDB(test_config.NewTestNode()))
|
||||
storageWatcher.SetStorageDiffSource("geth")
|
||||
storageWatcher.Queue = mockQueue
|
||||
storageWatcher.AddTransformers([]transformer.StorageTransformerInitializer{mockTransformer.FakeTransformerInitializer})
|
||||
})
|
||||
@ -193,7 +192,6 @@ var _ = Describe("Geth Storage Watcher", func() {
|
||||
mockQueue.DiffsToReturn = []utils.StorageDiff{gethDiff}
|
||||
storageWatcher = watcher.NewGethStorageWatcher(mockFetcher, test_config.NewTestDB(test_config.NewTestNode()))
|
||||
storageWatcher.Queue = mockQueue
|
||||
storageWatcher.SetStorageDiffSource("geth")
|
||||
storageWatcher.AddTransformers([]transformer.StorageTransformerInitializer{mockTransformer.FakeTransformerInitializer})
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user