From 6219daacbf999b5677c845f8ec3a2126d55eaad4 Mon Sep 17 00:00:00 2001 From: Chris Clark Date: Tue, 20 Oct 2015 14:10:30 -0700 Subject: [PATCH] Run integration tests in CI --- scripts/ci.sh | 11 ++++++++--- test/integration/wallet.js | 10 +++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/ci.sh b/scripts/ci.sh index 8aa8173848..bb918f4deb 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -33,23 +33,28 @@ unittest() { rm -rf test-compiled } +integrationtest() { + mocha test/integration/integration-test.js +} + oneNode() { lint typecheck unittest + integrationtest } twoNodes() { case "$NODE_INDEX" in - 0) lint && unittest;; - 1) typecheck;; + 0) lint && integrationtest;; + 1) typecheck && unittest;; *) echo "ERROR: invalid usage"; exit 2;; esac } threeNodes() { case "$NODE_INDEX" in - 0) lint;; + 0) lint && integrationtest;; 1) typecheck;; 2) unittest;; *) echo "ERROR: invalid usage"; exit 2;; diff --git a/test/integration/wallet.js b/test/integration/wallet.js index 9ef7677c56..7652f77227 100644 --- a/test/integration/wallet.js +++ b/test/integration/wallet.js @@ -12,7 +12,7 @@ function loadWallet() { try { const walletRaw = fs.readFileSync(secretPath, {encoding: 'utf8'}).trim(); return JSON.parse(walletRaw); - } catch(e) { + } catch (e) { return null; } } @@ -20,6 +20,14 @@ function loadWallet() { 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'); }