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

Function setup

xenomint/xxx_test.go:189–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187)
188
189func setup() {
190 const minNoFile uint64 = 4096
191 var (
192 err error
193 lmt syscall.Rlimit
194 )
195
196 if testingDataDir, err = ioutil.TempDir("", "CovenantSQL"); err != nil {
197 panic(err)
198 }
199
200 rand.Seed(time.Now().UnixNano())
201
202 if runtime.GOOS == "linux" {
203 // Set NOFILE limit
204 if err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lmt); err != nil {
205 panic(err)
206 }
207 if lmt.Max < minNoFile {
208 panic("insufficient max RLIMIT_NOFILE")
209 }
210 lmt.Cur = lmt.Max
211 if err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &lmt); err != nil {
212 panic(err)
213 }
214 }
215
216 // Initialze kms
217 testingNonceDifficulty = 2
218 testingPrivateKeyFile = path.Join(testingDataDir, "private.key")
219 testingPublicKeyStoreFile = path.Join(testingDataDir, "public.keystore")
220 if testingPrivateKey, testingPublicKey, err = ca.GenSecp256k1KeyPair(); err != nil {
221 panic(err)
222 }
223 kms.Unittest = true
224 kms.SetLocalKeyPair(testingPrivateKey, testingPublicKey)
225 if err = kms.SavePrivateKey(
226 testingPrivateKeyFile, testingPrivateKey, testingMasterKey,
227 ); err != nil {
228 panic(err)
229 }
230
231 log.SetLevel(log.DebugLevel)
232 log.SetOutput(os.Stdout)
233}
234
235func teardown() {
236 //trace.Stop()

Callers 1

TestMainFunction · 0.70

Calls 4

SetLocalKeyPairFunction · 0.92
SavePrivateKeyFunction · 0.92
SetLevelFunction · 0.92
SetOutputFunction · 0.92

Tested by

no test coverage detected