-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth/fetcher: fix test to avoid hanging. Partial fix for #23331 #23351
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -304,7 +304,7 @@ func TestTransactionFetcherSingletonRequesting(t *testing.T) { | |
func TestTransactionFetcherFailedRescheduling(t *testing.T) { | ||
// Create a channel to control when tx requests can fail | ||
proceed := make(chan struct{}) | ||
|
||
defer close(proceed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO this is a bad change. The |
||
testTransactionFetcherParallel(t, txFetcherTest{ | ||
init: func() *TxFetcher { | ||
return NewTxFetcher( | ||
|
@@ -1263,6 +1263,17 @@ func testTransactionFetcher(t *testing.T, tt txFetcherTest) { | |
fetcher.Start() | ||
defer fetcher.Stop() | ||
|
||
defer func() { // drain the wait chan on exit | ||
for { | ||
select { | ||
case <-wait: | ||
continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
default: | ||
return | ||
} | ||
} | ||
}() | ||
|
||
// Crunch through all the test steps and execute them | ||
for i, step := range tt.steps { | ||
switch step := step.(type) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: look into why this is needed