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

Function TestChain

xenomint/chain_test.go:213–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

211}
212
213func TestChain(t *testing.T) {
214 Convey("test xenomint chain", t, func() {
215 var c, err = setupChain(t.Name())
216 So(err, ShouldBeNil)
217
218 // Setup query requests
219 var (
220 sel = `SELECT v1, v2, v3 FROM bench WHERE k=?`
221 ins = `INSERT INTO bench VALUES (?, ?, ?, ?)`
222 rr *types.Request
223 wr *types.Request
224 priv *ca.PrivateKey
225 )
226 priv, err = kms.GetLocalPrivateKey()
227 So(err, ShouldBeNil)
228
229 // Write query
230 wr = buildRequest(types.WriteQuery, []types.Query{
231 buildQuery(ins, 0, 1, 2, 3),
232 })
233 err = wr.Sign(priv)
234 So(err, ShouldBeNil)
235
236 _, err = c.Query(wr)
237 So(err, ShouldBeNil)
238
239 // Read query
240 rr = buildRequest(types.ReadQuery, []types.Query{
241 buildQuery(sel, 0),
242 })
243 err = rr.Sign(priv)
244 So(err, ShouldBeNil)
245
246 _, err = c.Query(rr)
247 So(err, ShouldBeNil)
248
249 err = teardownChain(t.Name(), c)
250 So(err, ShouldBeNil)
251 })
252}

Callers

nothing calls this directly

Calls 8

GetLocalPrivateKeyFunction · 0.92
setupChainFunction · 0.85
teardownChainFunction · 0.85
NameMethod · 0.80
buildRequestFunction · 0.70
buildQueryFunction · 0.70
SignMethod · 0.65
QueryMethod · 0.65

Tested by

no test coverage detected