MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / startNodes

Function startNodes

cmd/cql-minerd/integration_test.go:100–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98}
99
100func startNodes() {
101 ctx := context.Background()
102
103 // wait for ports to be available
104 var err error
105
106 err = utils.WaitForPorts(ctx, "127.0.0.1", []int{
107 3122,
108 3121,
109 3120,
110 }, time.Millisecond*200)
111
112 if err != nil {
113 log.Fatalf("wait for port ready timeout: %v", err)
114 }
115
116 // start 3bps
117 var cmd *utils.CMD
118 if cmd, err = utils.RunCommandNB(
119 FJ(baseDir, "./bin/cqld.test"),
120 []string{"-config", FJ(testWorkingDir, "./integration/node_0/config.yaml"),
121 "-test.coverprofile", FJ(baseDir, "./cmd/cql-minerd/leader.cover.out"),
122 "-metric-web", "0.0.0.0:13122",
123 },
124 "leader", testWorkingDir, logDir, true,
125 ); err == nil {
126 nodeCmds = append(nodeCmds, cmd)
127 } else {
128 log.Errorf("start node failed: %v", err)
129 }
130 if cmd, err = utils.RunCommandNB(
131 FJ(baseDir, "./bin/cqld.test"),
132 []string{"-config", FJ(testWorkingDir, "./integration/node_1/config.yaml"),
133 "-test.coverprofile", FJ(baseDir, "./cmd/cql-minerd/follower1.cover.out"),
134 "-metric-web", "0.0.0.0:13121",
135 },
136 "follower1", testWorkingDir, logDir, false,
137 ); err == nil {
138 nodeCmds = append(nodeCmds, cmd)
139 } else {
140 log.Errorf("start node failed: %v", err)
141 }
142 if cmd, err = utils.RunCommandNB(
143 FJ(baseDir, "./bin/cqld.test"),
144 []string{"-config", FJ(testWorkingDir, "./integration/node_2/config.yaml"),
145 "-test.coverprofile", FJ(baseDir, "./cmd/cql-minerd/follower2.cover.out"),
146 "-metric-web", "0.0.0.0:13120",
147 },
148 "follower2", testWorkingDir, logDir, false,
149 ); err == nil {
150 nodeCmds = append(nodeCmds, cmd)
151 } else {
152 log.Errorf("start node failed: %v", err)
153 }
154
155 ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
156 defer cancel()
157 err = utils.WaitToConnect(ctx, "127.0.0.1", []int{

Callers 1

TestFullProcessFunction · 0.70

Calls 5

WaitForPortsFunction · 0.92
FatalfFunction · 0.92
RunCommandNBFunction · 0.92
ErrorfFunction · 0.92
WaitToConnectFunction · 0.92

Tested by

no test coverage detected