forked from scroll-tech/scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulation.go
40 lines (33 loc) · 1.01 KB
/
simulation.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
package utils
import (
"fmt"
"os"
"github.com/docker/docker/pkg/reexec"
"github.com/urfave/cli/v2"
)
// MockAppName a new type mock app.
type MockAppName string
var (
// GasOracleApp the name of mock gas-oracle app.
GasOracleApp MockAppName = "gas-oracle-test"
// RollupRelayerApp the name of mock rollup-relayer app.
RollupRelayerApp MockAppName = "rollup-relayer-test"
// DBCliApp the name of mock database app.
DBCliApp MockAppName = "db_cli-test"
// CoordinatorAPIApp the name of mock coordinator app.
CoordinatorAPIApp MockAppName = "coordinator-api-test"
// CoordinatorCronApp the name of mock coordinator cron app.
CoordinatorCronApp MockAppName = "coordinator-cron-test"
)
// RegisterSimulation register initializer function for integration-test.
func RegisterSimulation(app *cli.App, name MockAppName) {
// Run the app for integration-test
reexec.Register(string(name), func() {
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
os.Exit(0)
})
reexec.Init()
}