cmd/geth, internal: fix flaky console tests (#31784)

This pull request bumps the timeout for flaky console tests on appveyor.
This commit is contained in:
rjl493456442 2025-05-08 21:15:36 +08:00 committed by GitHub
parent 10519768a2
commit 181dd2e660
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 11 deletions

View file

@ -102,17 +102,17 @@ func TestAttachWelcome(t *testing.T) {
"--http", "--http.port", httpPort,
"--ws", "--ws.port", wsPort)
t.Run("ipc", func(t *testing.T) {
waitForEndpoint(t, ipc, 4*time.Second)
waitForEndpoint(t, ipc, 2*time.Minute)
testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs)
})
t.Run("http", func(t *testing.T) {
endpoint := "http://127.0.0.1:" + httpPort
waitForEndpoint(t, endpoint, 4*time.Second)
waitForEndpoint(t, endpoint, 2*time.Minute)
testAttachWelcome(t, geth, endpoint, httpAPIs)
})
t.Run("ws", func(t *testing.T) {
endpoint := "ws://127.0.0.1:" + wsPort
waitForEndpoint(t, endpoint, 4*time.Second)
waitForEndpoint(t, endpoint, 2*time.Minute)
testAttachWelcome(t, geth, endpoint, httpAPIs)
})
geth.Kill()

View file

@ -134,13 +134,17 @@ func TestSendTx(t *testing.T) {
func testSendTx(t *testing.T, withLocal bool) {
b := initBackend(withLocal)
txA := pricedSetCodeTx(0, 250000, uint256.NewInt(params.GWei), uint256.NewInt(params.GWei), key, []unsignedAuth{
{
nonce: 0,
key: key,
},
})
b.SendTx(context.Background(), txA)
txA := pricedSetCodeTx(0, 250000, uint256.NewInt(params.GWei), uint256.NewInt(params.GWei), key, []unsignedAuth{{nonce: 0, key: key}})
if err := b.SendTx(context.Background(), txA); err != nil {
t.Fatalf("Failed to submit tx: %v", err)
}
for {
pending, _ := b.TxPool().ContentFrom(address)
if len(pending) == 1 {
break
}
time.Sleep(100 * time.Millisecond)
}
txB := makeTx(1, nil, nil, key)
err := b.SendTx(context.Background(), txB)

View file

@ -237,7 +237,7 @@ func (tt *TestCmd) Kill() {
}
func (tt *TestCmd) withKillTimeout(fn func()) {
timeout := time.AfterFunc(30*time.Second, func() {
timeout := time.AfterFunc(2*time.Minute, func() {
tt.Log("killing the child process (timeout)")
tt.Kill()
})