diff --git a/libraries/shared/fetcher/geth_rpc_storage_fetcher.go b/libraries/shared/fetcher/geth_rpc_storage_fetcher.go index d7f24fa1..fc48c5ab 100644 --- a/libraries/shared/fetcher/geth_rpc_storage_fetcher.go +++ b/libraries/shared/fetcher/geth_rpc_storage_fetcher.go @@ -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) diff --git a/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go b/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go index 9080c2f7..90ae5b07 100644 --- a/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go +++ b/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go @@ -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) diff --git a/libraries/shared/watcher/geth_storage_watcher_test.go b/libraries/shared/watcher/geth_storage_watcher_test.go index 99eee605..bc999ec0 100644 --- a/libraries/shared/watcher/geth_storage_watcher_test.go +++ b/libraries/shared/watcher/geth_storage_watcher_test.go @@ -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}) })