forked from bitcoinz-sites/BTCz-Pay
-
Notifications
You must be signed in to change notification settings - Fork 2
/
smoke-test.js
42 lines (39 loc) · 1.26 KB
/
smoke-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* ==============================================================================
* BTCz-Pay
* ==============================================================================
*
* Version 0.2.1 (production v1.0)
*
* Self-hosted bitcoinZ payment gateway
* https://github.com/MarcelusCH/BTCz-Pay
*
* ------------------------------------------------------------------------------
* smoke-test.js Required by other processes
* ------------------------------------------------------------------------------
*
* Simple smoke tests to check accessibility of database and RPC
* Log error into consol and exit on error with code 1 or 2
*
* ==============================================================================
*/
let bitcoind = require('./models/blockchain')
let rp = require('request-promise')
let config = require('./config')
let assert = require('assert')
;(async () => {
try {
let info = await bitcoind.getblockchaininfo()
assert(info.result.chain)
} catch (err) {
console.log('BitcoinZ Core RPC problem: ', err)
process.exit(1)
}
try {
let couchdb = await rp.get({url: config.couchdb, json: true})
assert(couchdb.db_name)
} catch (err) {
console.log('Couchdb problem: ', err)
process.exit(2)
}
})()