stress testing; add mock-ticker
This commit is contained in:
parent
ad66fe1b43
commit
272405b4b1
5 changed files with 30 additions and 9 deletions
1
.migrate-stress
Normal file
1
.migrate-stress
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"migrations":[{"title":"001-initial.js"},{"title":"002-bills.js"},{"title":"003-device-events.js"},{"title":"004-transactions-reload.js"},{"title":"005-addCrypto.js"},{"title":"006-add-machine-config.js"},{"title":"007-add-phone.js"},{"title":"008-add-two-way.js"},{"title":"009-update-timestamps.js"},{"title":"010-cached-requests.js"},{"title":"011-transactions-reload-2.js"},{"title":"012-add-hd-path-serial.js"},{"title":"013-add-last-checked.js"},{"title":"014-session-to-tx-id.js"},{"title":"015-paired_devices.js"},{"title":"016-new_cached_requests_table.js"},{"title":"017-user_tokens.js"},{"title":"018-alter_devices.js"},{"title":"019-remove-dispense-counts.js"},{"title":"020-add-server-events.js"},{"title":"021-config-version-id.js"},{"title":"022-add_cash_in_sent.js"},{"title":"023-add-dispenses-to-cash-out.js"},{"title":"024-consolidate-hd.js"},{"title":"025-create_trades.js"},{"title":"026-add_send_confirmed.js"},{"title":"027-tx_errors.js"},{"title":"028-cash_out_actions.js"},{"title":"029-add_valid_to_user_config.js"},{"title":"030-cash-out-provision.js"},{"title":"031-remove_name_from_devices.js"},{"title":"032-create_machine_pings_table.js"},{"title":"033-add_cash_in_fee.js"},{"title":"034-add_cash_out_error_code.js"},{"title":"035-log_bank_notes.js"}],"path":"/Users/josh/projects/lamassu-server/.migrate-stress","pos":35}
|
||||
|
|
@ -7,6 +7,7 @@ const options = require('../lib/options')
|
|||
const migrateDir = path.resolve(__dirname, '..', 'migrations')
|
||||
const migration = migrate.load(options.migrateStatePath, migrateDir)
|
||||
|
||||
console.log(options.migrateStatePath)
|
||||
migration.up(err => {
|
||||
if (err) {
|
||||
console.error('DB Migration failed: %s', err)
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ function fetchData () {
|
|||
{code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC']},
|
||||
{code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'LTC']},
|
||||
{code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC']},
|
||||
{code: 'mock-ticker', display: 'Mock ticker', class: 'ticker', cryptos: ALL_CRYPTOS},
|
||||
{code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC']},
|
||||
{code: 'geth', display: 'geth', class: 'wallet', cryptos: ['ETH']},
|
||||
{code: 'zcashd', display: 'zcashd', class: 'wallet', cryptos: ['ZEC']},
|
||||
|
|
|
|||
|
|
@ -4,21 +4,27 @@ const os = require('os')
|
|||
const _ = require('lodash/fp')
|
||||
const argv = require('minimist')(process.argv.slice(2))
|
||||
|
||||
let serverConfig
|
||||
function load () {
|
||||
if (argv.f) {
|
||||
const configPath = argv.f
|
||||
return JSON.parse(fs.readFileSync(configPath))
|
||||
}
|
||||
|
||||
try {
|
||||
const globalConfigPath = path.resolve('/etc', 'lamassu', 'lamassu.json')
|
||||
serverConfig = JSON.parse(fs.readFileSync(globalConfigPath))
|
||||
return JSON.parse(fs.readFileSync(globalConfigPath))
|
||||
} catch (_) {
|
||||
try {
|
||||
const homeConfigPath = path.resolve(os.homedir(), '.lamassu', 'lamassu.json')
|
||||
serverConfig = JSON.parse(fs.readFileSync(homeConfigPath))
|
||||
return JSON.parse(fs.readFileSync(homeConfigPath))
|
||||
} catch (_) {
|
||||
console.error("Couldn't open lamassu.json config file.")
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const serverConfig = load()
|
||||
const defaults = {logLevel: 'info'}
|
||||
const commandLine = {logLevel: argv.logLevel}
|
||||
|
||||
|
|
|
|||
12
lib/plugins/ticker/mock-ticker/mock-ticker.js
Normal file
12
lib/plugins/ticker/mock-ticker/mock-ticker.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
const BN = require('../../../bn')
|
||||
|
||||
function ticker (account, fiatCode, cryptoCode) {
|
||||
return Promise.resolve({
|
||||
rates: {
|
||||
ask: BN(105),
|
||||
bid: BN(100)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {ticker}
|
||||
Loading…
Add table
Add a link
Reference in a new issue