* eth/fetcher: fix test to avoid hanging. Partial fix for #23331 * eth/filters: avoid dangling goroutines * eth/fetcher: revert closing of proceed
This commit is contained in:
parent
3b967d16ca
commit
7175f82495
@ -304,7 +304,6 @@ func TestTransactionFetcherSingletonRequesting(t *testing.T) {
|
|||||||
func TestTransactionFetcherFailedRescheduling(t *testing.T) {
|
func TestTransactionFetcherFailedRescheduling(t *testing.T) {
|
||||||
// Create a channel to control when tx requests can fail
|
// Create a channel to control when tx requests can fail
|
||||||
proceed := make(chan struct{})
|
proceed := make(chan struct{})
|
||||||
|
|
||||||
testTransactionFetcherParallel(t, txFetcherTest{
|
testTransactionFetcherParallel(t, txFetcherTest{
|
||||||
init: func() *TxFetcher {
|
init: func() *TxFetcher {
|
||||||
return NewTxFetcher(
|
return NewTxFetcher(
|
||||||
@ -1263,6 +1262,16 @@ func testTransactionFetcher(t *testing.T, tt txFetcherTest) {
|
|||||||
fetcher.Start()
|
fetcher.Start()
|
||||||
defer fetcher.Stop()
|
defer fetcher.Stop()
|
||||||
|
|
||||||
|
defer func() { // drain the wait chan on exit
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-wait:
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// Crunch through all the test steps and execute them
|
// Crunch through all the test steps and execute them
|
||||||
for i, step := range tt.steps {
|
for i, step := range tt.steps {
|
||||||
switch step := step.(type) {
|
switch step := step.(type) {
|
||||||
|
@ -301,12 +301,15 @@ func TestLogFilterCreation(t *testing.T) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
for i, test := range testCases {
|
for i, test := range testCases {
|
||||||
_, err := api.NewFilter(test.crit)
|
id, err := api.NewFilter(test.crit)
|
||||||
if test.success && err != nil {
|
if err != nil && test.success {
|
||||||
t.Errorf("expected filter creation for case %d to success, got %v", i, err)
|
t.Errorf("expected filter creation for case %d to success, got %v", i, err)
|
||||||
}
|
}
|
||||||
if !test.success && err == nil {
|
if err == nil {
|
||||||
t.Errorf("expected testcase %d to fail with an error", i)
|
api.UninstallFilter(id)
|
||||||
|
if !test.success {
|
||||||
|
t.Errorf("expected testcase %d to fail with an error", i)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user