mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 20:11:21 +00:00
7754f53385
* TestTable_ReadRandomNodesGetAll: refactor to integration and examples * TestTable_bumpNoDuplicates: refactor to integration and examples * TestUDPv4_smallNetConvergence: speed up from 1.7s to 0.3s by applying the test config * TestUPNP_DDWRT: move to integration tests * TestFairMix: split in 2, do more iterations in integration tests * TestDialSched: speed up from 1s to 0.2s by removing the unexpected dial check, (keep the check during the integration tests)
63 lines
1.2 KiB
Go
63 lines
1.2 KiB
Go
//go:build integration
|
|
// +build integration
|
|
|
|
package discover
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
"testing/quick"
|
|
"time"
|
|
)
|
|
|
|
func TestTable_bumpNoDuplicates_quickCheck(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
config := quick.Config{
|
|
MaxCount: 200,
|
|
Rand: rand.New(rand.NewSource(time.Now().Unix())),
|
|
}
|
|
|
|
test := func(bucketCountGen byte, bumpCountGen byte) bool {
|
|
return testTableBumpNoDuplicatesRun(t, bucketCountGen, bumpCountGen, config.Rand)
|
|
}
|
|
|
|
if err := quick.Check(test, &config); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestTable_findNodeByID_quickCheck(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
config := quick.Config{
|
|
MaxCount: 1000,
|
|
Rand: rand.New(rand.NewSource(time.Now().Unix())),
|
|
}
|
|
|
|
test := func(nodesCount uint16, resultsCount byte) bool {
|
|
return testTableFindNodeByIDRun(t, nodesCount, resultsCount, config.Rand)
|
|
}
|
|
|
|
if err := quick.Check(test, &config); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestTable_ReadRandomNodesGetAll_quickCheck(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
config := quick.Config{
|
|
MaxCount: 200,
|
|
Rand: rand.New(rand.NewSource(time.Now().Unix())),
|
|
}
|
|
|
|
test := func(nodesCount uint16) bool {
|
|
return testTableReadRandomNodesGetAllRun(t, nodesCount, config.Rand)
|
|
}
|
|
|
|
if err := quick.Check(test, &config); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|