forked from ten-protocol/go-ten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulation_geth_in_mem_test.go
43 lines (33 loc) · 1.24 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
package simulation
import (
"os"
"testing"
"time"
"github.com/obscuronet/go-obscuro/integration"
"github.com/obscuronet/go-obscuro/integration/simulation/network"
"github.com/obscuronet/go-obscuro/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.ObscuroChainID)
simParams := ¶ms.SimParams{
NumberOfNodes: numberOfNodes,
AvgBlockDuration: 1 * time.Second,
SimulationTime: 35 * time.Second,
L1EfficiencyThreshold: 0.2,
Wallets: wallets,
StartPort: integration.StartPortSimulationGethInMem,
IsInMem: true,
ReceiptTimeout: 30 * time.Second,
StoppingDelay: 10 * time.Second,
}
simParams.AvgNetworkLatency = simParams.AvgBlockDuration / 15
testSimulation(t, network.NewNetworkInMemoryGeth(wallets), simParams)
}