-
Notifications
You must be signed in to change notification settings - Fork 36
/
simulation_geth_in_mem_test.go
46 lines (36 loc) · 1.36 KB
/
simulation_geth_in_mem_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package simulation
import (
"os"
"testing"
"time"
"github.com/ten-protocol/go-ten/integration"
"github.com/ten-protocol/go-ten/integration/simulation/network"
"github.com/ten-protocol/go-ten/integration/simulation/params"
)
const (
gethTestEnv = "GETH_TEST_ENABLED"
)
// TestGethSimulation runs the simulation against a private geth network using Clique (PoA)
func TestGethSimulation(t *testing.T) {
if os.Getenv(gethTestEnv) == "" {
t.Skipf("set the variable to run this test: `%s=true`", gethTestEnv)
}
setupSimTestLog("geth-in-mem")
numberOfNodes := 5
numberOfSimWallets := 5
wallets := params.NewSimWallets(numberOfSimWallets, numberOfNodes, integration.EthereumChainID, integration.TenChainID)
simParams := ¶ms.SimParams{
NumberOfNodes: numberOfNodes,
AvgBlockDuration: 1 * time.Second,
SimulationTime: 35 * time.Second,
L1EfficiencyThreshold: 0.2,
Wallets: wallets,
StartPort: integration.TestPorts.TestGethSimulationPort,
IsInMem: true,
ReceiptTimeout: 30 * time.Second,
StoppingDelay: 10 * time.Second,
L1BeaconPort: integration.TestPorts.TestGethSimulationPort + integration.DefaultPrysmGatewayPortOffset,
}
simParams.AvgNetworkLatency = simParams.AvgBlockDuration / 15
testSimulation(t, network.NewNetworkInMemoryGeth(wallets), simParams)
}