MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestMuxService

Function TestMuxService

xenomint/mux_test.go:254–306  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

252}
253
254func TestMuxService(t *testing.T) {
255 Convey("test xenomint MuxService", t, func() {
256 var (
257 err error
258 priv *ca.PrivateKey
259 bp, miner *nodeRPCInfo
260 ms *MuxService
261 c *Chain
262
263 sel = `SELECT v1, v2, v3 FROM bench WHERE k=?`
264 rr *types.Request
265
266 method = fmt.Sprintf("%s.%s", benchmarkRPCName, "Query")
267 )
268 // Use testing private key to create several nodes
269 priv, err = kms.GetLocalPrivateKey()
270 So(err, ShouldBeNil)
271
272 bp, miner, ms, err = setupMuxParallel(priv)
273 So(err, ShouldBeNil)
274 defer teardownBenchmarkMuxParallel(bp.server, miner.server)
275
276 var caller = rpc.NewPersistentCaller(miner.node.ID)
277
278 c, err = setupChain(t.Name())
279 So(err, ShouldBeNil)
280
281 ms.register(benchmarkDatabaseID, c)
282 defer func() {
283 ms.unregister(benchmarkDatabaseID)
284 _ = teardownChain(t.Name(), c)
285 }()
286
287 // Setup query requests
288 rr = buildRequest(types.ReadQuery, []types.Query{
289 buildQuery(sel, 0),
290 })
291 err = rr.Sign(priv)
292 So(err, ShouldBeNil)
293
294 r := &MuxQueryRequest{
295 DatabaseID: benchmarkDatabaseID,
296 Request: rr,
297 }
298 err = caller.Call(
299 method, &r, &MuxQueryResponse{},
300 )
301 So(err, ShouldBeNil)
302 err = c.state.commit()
303 So(err, ShouldBeNil)
304
305 })
306}

Callers

nothing calls this directly

Calls 13

GetLocalPrivateKeyFunction · 0.92
setupMuxParallelFunction · 0.85
setupChainFunction · 0.85
teardownChainFunction · 0.85
NameMethod · 0.80
buildRequestFunction · 0.70
buildQueryFunction · 0.70
SignMethod · 0.65
CallMethod · 0.65
registerMethod · 0.45
unregisterMethod · 0.45

Tested by

no test coverage detected