GitHub Actions Integration Tests (#1466)

* ci: Add Github Actions integration testing against standalone rippled
This commit is contained in:
Nathan Nichols
2021-07-27 10:47:55 -07:00
committed by GitHub
parent d941653477
commit 9adfd404e5
7 changed files with 42 additions and 138 deletions

View File

@@ -1,44 +1,14 @@
'use strict';
const _ = require('lodash');
const fs = require('fs');
const path = require('path');
function getUserHomePath() {
return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
function getAddress() {
return 'rQDhz2ZNXmhxzCYwxU6qAbdxsHA4HV45Y2';
}
function loadWallet() {
const secretPath = path.join(getUserHomePath(), '.ripple_wallet');
try {
const walletRaw = fs.readFileSync(secretPath, {encoding: 'utf8'}).trim();
return JSON.parse(walletRaw);
} catch (e) {
return null;
}
}
const WALLET = loadWallet();
function getTestKey(key) {
if (process.env.TEST_ADDRESS && process.env.TEST_SECRET) {
if (key === 'address') {
return process.env.TEST_ADDRESS;
}
if (key === 'secret') {
return process.env.TEST_SECRET;
}
}
if (WALLET === null) {
throw new Error('Could not find .ripple_wallet file in home directory');
}
if (WALLET.test === undefined) {
throw new Error('Wallet does not contain a "test" account');
}
return WALLET.test[key];
function getSecret() {
return 'shK6YXzwYfnFVn3YZSaMh5zuAddKx';
}
module.exports = {
getAddress: _.partial(getTestKey, 'address'),
getSecret: _.partial(getTestKey, 'secret')
getAddress,
getSecret
};