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

Function setup

blockproducer/xxx_test.go:46–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44)
45
46func setup() {
47 var err error
48 rand.Seed(time.Now().UnixNano())
49 rand.Read(genesisHash[:])
50
51 // Create temp dir for test data
52 if testingDataDir, err = ioutil.TempDir("", "CovenantSQL"); err != nil {
53 panic(err)
54 }
55
56 // Initialze kms
57 testingNonceDifficulty = 2
58 testingPublicKeyStoreFile = path.Join(testingDataDir, "public.keystore")
59
60 if conf.GConf, err = conf.LoadConfig(testingConfigFile); err != nil {
61 panic(err)
62 }
63 route.InitKMS(testingPublicKeyStoreFile)
64 if err = kms.InitLocalKeyPair(testingPrivateKeyFile, []byte{}); err != nil {
65 panic(err)
66 }
67 if testingPrivateKey, err = kms.GetLocalPrivateKey(); err != nil {
68 panic(err)
69 }
70 testingPublicKey = testingPrivateKey.PubKey()
71
72 // Setup logging
73 log.SetOutput(os.Stdout)
74 log.SetLevel(log.DebugLevel)
75}
76
77func teardown() {
78 if err := os.RemoveAll(testingDataDir); err != nil {

Callers 1

TestMainFunction · 0.70

Calls 8

LoadConfigFunction · 0.92
InitKMSFunction · 0.92
InitLocalKeyPairFunction · 0.92
GetLocalPrivateKeyFunction · 0.92
SetOutputFunction · 0.92
SetLevelFunction · 0.92
PubKeyMethod · 0.80
ReadMethod · 0.65

Tested by

no test coverage detected