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

Function setup

sqlchain/xxx_test.go:328–367  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

326}
327
328func setup() {
329 // Setup RNG
330 rand.Seed(time.Now().UnixNano())
331 rand.Read(genesisHash[:])
332
333 // Create temp dir
334 var err error
335 testDataDir, err = ioutil.TempDir("", "covenantsql")
336
337 if err != nil {
338 panic(err)
339 }
340
341 testPubKeysFile = path.Join(testDataDir, "public.keystore")
342 testPrivKeyFile = path.Join(testDataDir, "private.key")
343 testDHTStoreFile = path.Join(testDataDir, "dht.db")
344
345 // Setup public key store
346 if err = kms.InitPublicKeyStore(testPubKeysFile, nil); err != nil {
347 panic(err)
348 }
349
350 // Setup local key store
351 kms.Unittest = true
352 testPrivKey, testPubKey, err = asymmetric.GenSecp256k1KeyPair()
353
354 if err != nil {
355 panic(err)
356 }
357
358 kms.SetLocalKeyPair(testPrivKey, testPubKey)
359
360 if err = kms.SavePrivateKey(testPrivKeyFile, testPrivKey, testMasterKey); err != nil {
361 panic(err)
362 }
363
364 // Setup logging
365 log.SetOutput(os.Stdout)
366 log.SetLevel(log.DebugLevel)
367}
368
369func teardown() {
370 if err := os.RemoveAll(testDataDir); err != nil {

Callers 1

TestMainFunction · 0.70

Calls 7

InitPublicKeyStoreFunction · 0.92
GenSecp256k1KeyPairFunction · 0.92
SetLocalKeyPairFunction · 0.92
SavePrivateKeyFunction · 0.92
SetOutputFunction · 0.92
SetLevelFunction · 0.92
ReadMethod · 0.65

Tested by

no test coverage detected