()
| 44 | ) |
| 45 | |
| 46 | func 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 | |
| 77 | func teardown() { |
| 78 | if err := os.RemoveAll(testingDataDir); err != nil { |
no test coverage detected