-
Notifications
You must be signed in to change notification settings - Fork 20.9k
core, trie, rpc: speed up tests #28461
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
Changes from all commits
b051500
c413663
cb349b0
be78565
62a3291
08be7f1
65bebf3
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 |
---|---|---|
|
@@ -68,7 +68,7 @@ func waitWatcherStart(ks *KeyStore) bool { | |
|
||
func waitForAccounts(wantAccounts []accounts.Account, ks *KeyStore) error { | ||
var list []accounts.Account | ||
for t0 := time.Now(); time.Since(t0) < 5*time.Second; time.Sleep(200 * time.Millisecond) { | ||
for t0 := time.Now(); time.Since(t0) < 5*time.Second; time.Sleep(100 * time.Millisecond) { | ||
list = ks.Accounts() | ||
if reflect.DeepEqual(list, wantAccounts) { | ||
// ks should have also received change notifications | ||
|
@@ -350,7 +350,7 @@ func TestUpdatedKeyfileContents(t *testing.T) { | |
return | ||
} | ||
// needed so that modTime of `file` is different to its current value after forceCopyFile | ||
time.Sleep(time.Second) | ||
os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) | ||
|
||
// Now replace file contents | ||
if err := forceCopyFile(file, cachetestAccounts[1].URL.Path); err != nil { | ||
|
@@ -366,7 +366,7 @@ func TestUpdatedKeyfileContents(t *testing.T) { | |
} | ||
|
||
// needed so that modTime of `file` is different to its current value after forceCopyFile | ||
time.Sleep(time.Second) | ||
os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) | ||
|
||
// Now replace file contents again | ||
if err := forceCopyFile(file, cachetestAccounts[2].URL.Path); err != nil { | ||
|
@@ -382,7 +382,7 @@ func TestUpdatedKeyfileContents(t *testing.T) { | |
} | ||
|
||
// needed so that modTime of `file` is different to its current value after os.WriteFile | ||
time.Sleep(time.Second) | ||
os.Chtimes(file, time.Now().Add(-time.Second), time.Now().Add(-time.Second)) | ||
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. Looks a bit odd to me that you are (over and over) setting mtime/atime to 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. I think that |
||
|
||
// Now replace file contents with crap | ||
if err := os.WriteFile(file, []byte("foo"), 0600); err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,7 +595,7 @@ func TestClientSubscriptionChannelClose(t *testing.T) { | |
|
||
for i := 0; i < 100; i++ { | ||
ch := make(chan int, 100) | ||
sub, err := client.Subscribe(context.Background(), "nftest", ch, "someSubscription", maxClientSubscriptionBuffer-1, 1) | ||
sub, err := client.Subscribe(context.Background(), "nftest", ch, "someSubscription", 100, 1) | ||
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 change makes a huge difference in execution speed, however, the semantics of this test is pretty complicated. Would be good if @fjl checks that the test semantics are still maintained. 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. As far as I understood the test it just opens a lot of subscriptions and subscribes to a lot of messages, then shuts down the subscriptions in order to catch a racy error 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. @fjl pls ack if this LGTY? 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. Sorry for the slow response. It's OK to change this. |
||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.