Browse Source

Merge pull request #2154 from tendermint/bucky/speed-up-tests

speed up some tests. ref #2038
pull/2177/head
Ethan Buchman 6 years ago
committed by GitHub
parent
commit
ef5c27a2d2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions
  1. +3
    -3
      abci/example/example_test.go
  2. +5
    -5
      libs/clist/clist_test.go
  3. +0
    -2
      p2p/conn/connection_test.go

+ 3
- 3
abci/example/example_test.go View File

@ -39,7 +39,7 @@ func TestGRPC(t *testing.T) {
}
func testStream(t *testing.T, app types.Application) {
numDeliverTxs := 200000
numDeliverTxs := 20000
// Start the listener
server := abciserver.NewSocketServer("unix://test.sock", app)
@ -72,7 +72,7 @@ func testStream(t *testing.T, app types.Application) {
}
if counter == numDeliverTxs {
go func() {
time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow
time.Sleep(time.Second * 1) // Wait for a bit to allow counter overflow
close(done)
}()
return
@ -148,7 +148,7 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
t.Log("response", counter)
if counter == numDeliverTxs {
go func() {
time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow
time.Sleep(time.Second * 1) // Wait for a bit to allow counter overflow
}()
}


+ 5
- 5
libs/clist/clist_test.go View File

@ -149,8 +149,8 @@ func _TestGCRandom(t *testing.T) {
func TestScanRightDeleteRandom(t *testing.T) {
const numElements = 10000
const numTimes = 1000
const numElements = 1000
const numTimes = 100
const numScanners = 10
l := New()
@ -209,7 +209,7 @@ func TestScanRightDeleteRandom(t *testing.T) {
// Stop scanners
close(stop)
time.Sleep(time.Second * 1)
// time.Sleep(time.Second * 1)
// And remove all the elements.
for el := l.Front(); el != nil; el = el.Next() {
@ -244,7 +244,7 @@ func TestWaitChan(t *testing.T) {
for i := 1; i < 100; i++ {
l.PushBack(i)
pushed++
time.Sleep(time.Duration(cmn.RandIntn(100)) * time.Millisecond)
time.Sleep(time.Duration(cmn.RandIntn(25)) * time.Millisecond)
}
close(done)
}()
@ -283,7 +283,7 @@ FOR_LOOP2:
if prev == nil {
t.Fatal("expected PrevWaitChan to block forever on nil when reached first elem")
}
case <-time.After(5 * time.Second):
case <-time.After(3 * time.Second):
break FOR_LOOP2
}
}


+ 0
- 2
p2p/conn/connection_test.go View File

@ -433,7 +433,6 @@ func TestMConnectionReadErrorLongMessage(t *testing.T) {
_, err = client.Write(buf.Bytes())
assert.Nil(t, err)
assert.True(t, expectSend(chOnRcv), "msg just right")
assert.False(t, expectSend(chOnErr), "msg just right")
// send msg thats too long
buf = new(bytes.Buffer)
@ -446,7 +445,6 @@ func TestMConnectionReadErrorLongMessage(t *testing.T) {
assert.Nil(t, err)
_, err = client.Write(buf.Bytes())
assert.NotNil(t, err)
assert.False(t, expectSend(chOnRcv), "msg too long")
assert.True(t, expectSend(chOnErr), "msg too long")
}


Loading…
Cancel
Save