feat: idle machine polling
This commit is contained in:
parent
ea36d66167
commit
20727a60cd
7 changed files with 198 additions and 0 deletions
12
test/stress/utils/init-cert.js
Normal file
12
test/stress/utils/init-cert.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
const path = require('path')
|
||||
const variables = require('./variables')
|
||||
const { init } = require(`../${variables.MACHINE_PATH}/lib/pairing`)
|
||||
|
||||
const number = process.argv[2]
|
||||
|
||||
const certPath = {
|
||||
cert: path.resolve(process.cwd(), 'machines', number, 'client.pem'),
|
||||
key: path.resolve(process.cwd(), 'machines', number, 'client.key')
|
||||
}
|
||||
|
||||
init(certPath)
|
||||
28
test/stress/utils/save-config.js
Normal file
28
test/stress/utils/save-config.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const number = process.argv[2]
|
||||
const machine = process.argv[3]
|
||||
const old = require('../config.json')
|
||||
|
||||
function configAddField (scope, fieldCode, fieldType, fieldClass, value) {
|
||||
return {
|
||||
fieldLocator: {
|
||||
fieldScope: {
|
||||
crypto: scope.crypto,
|
||||
machine: scope.machine
|
||||
},
|
||||
code: fieldCode,
|
||||
fieldType,
|
||||
fieldClass
|
||||
},
|
||||
fieldValue: { fieldType, value }
|
||||
}
|
||||
}
|
||||
|
||||
const scope = { crypto: 'global', machine }
|
||||
|
||||
const newFields = [
|
||||
configAddField(scope, 'cashOutEnabled', 'onOff', null, false),
|
||||
configAddField(scope, 'machineName', 'string', null, number),
|
||||
configAddField(scope, 'machineModel', 'string', null, 'Linux')
|
||||
]
|
||||
const data = { config: newFields.concat(old.config) }
|
||||
console.log(JSON.stringify(data))
|
||||
5
test/stress/utils/variables.js
Normal file
5
test/stress/utils/variables.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
const NUMBER_OF_MACHINES = 4
|
||||
const SERVER_CERT_PATH = `../../certs/Lamassu_OP_Root_CA.pem`
|
||||
const MACHINE_PATH = `../../../lamassu-machine`
|
||||
|
||||
module.exports = { NUMBER_OF_MACHINES, SERVER_CERT_PATH, MACHINE_PATH }
|
||||
Loading…
Add table
Add a link
Reference in a new issue