aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-08-04 21:58:21 +0200
committerFlorian Dold <florian@dold.me>2021-08-04 21:58:21 +0200
commit0c6bb04356d4e44d6c9dc251efd4304a51ed0ba9 (patch)
tree07d4aa1b8e9d09b428c7c660b56604614bba885c /packages
parentc3f23d0eaba3a2bcf538e716358522c416e45d9b (diff)
linting
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-cli/src/lint.ts56
1 files changed, 46 insertions, 10 deletions
diff --git a/packages/taler-wallet-cli/src/lint.ts b/packages/taler-wallet-cli/src/lint.ts
index 4f6b4d605..e716d053f 100644
--- a/packages/taler-wallet-cli/src/lint.ts
+++ b/packages/taler-wallet-cli/src/lint.ts
@@ -26,6 +26,7 @@ import {
codecForList,
codecForString,
Configuration,
+ durationFromSpec,
} from "@gnu-taler/taler-util";
import {
decodeCrock,
@@ -36,6 +37,7 @@ import { URL } from "url";
import * as fs from "fs";
import * as path from "path";
import { ChildProcess, spawn } from "child_process";
+import { delayMs } from "./integrationtests/harness.js";
interface BasicConf {
mainCurrency: string;
@@ -145,7 +147,7 @@ function checkCoinConfig(cfg: Configuration, basic: BasicConf): void {
}
}
-function checkWireConfig(cfg: Configuration): void {
+async function checkWireConfig(cfg: Configuration): Promise<void> {
const accountPrefix = "EXCHANGE-ACCOUNT-";
const accountCredentialsPrefix = "EXCHANGE-ACCOUNTCREDENTIALS-";
@@ -172,17 +174,40 @@ function checkWireConfig(cfg: Configuration): void {
}
}
- // FIXME: now try to use taler-exchange-wire-gateway-client to connect!
+ const res = await sh(
+ "sudo -u taler-exchange-wirewatch taler-exchange-wirewatch -t",
+ );
+ if (res.status != 0) {
+ console.log(res.stdout);
+ console.log(res.stderr);
+ console.log("error: Could not run aggregator. Please review logs above.");
+ process.exit(1);
+ }
+
// FIXME: run wirewatch in test mode here?
// FIXME: run transfer in test mode here?
}
-function checkAggregatorConfig(cfg: Configuration) {
- // FIXME: run aggregator in test mode here
+async function checkAggregatorConfig(cfg: Configuration) {
+ const res = await sh(
+ "sudo -u taler-exchange-aggregator taler-exchange-aggregator -t",
+ );
+ if (res.status != 0) {
+ console.log(res.stdout);
+ console.log(res.stderr);
+ console.log("error: Could not run aggregator. Please review logs above.");
+ process.exit(1);
+ }
}
-function checkCloserConfig(cfg: Configuration) {
- // FIXME: run closer in test mode here
+async function checkCloserConfig(cfg: Configuration) {
+ const res = await sh("sudo -u taler-exchange-close taler-exchange-closer -t");
+ if (res.status != 0) {
+ console.log(res.stdout);
+ console.log(res.stderr);
+ console.log("error: Could not run aggregator. Please review logs above.");
+ process.exit(1);
+ }
}
function checkMasterPublicKeyConfig(cfg: Configuration): PubkeyConf {
@@ -259,7 +284,18 @@ export async function checkExchangeHttpd(
{
const keysUrl = new URL("keys", baseUrl);
- const resp = await httpLib.get(keysUrl.href);
+
+ const resp = await Promise.race([httpLib.get(keysUrl.href), delayMs(2000)]);
+
+ if (!resp) {
+ console.log(
+ "error: request to /keys timed out." +
+ "Make sure to sign and upload denomination and signing keys " +
+ "with taler-exchange-offline.",
+ );
+ process.exit(1);
+ }
+
const keys = await readSuccessResponseJsonOrThrow(
resp,
codecForExchangeKeysJson(),
@@ -289,11 +325,11 @@ export async function lintExchangeDeployment(): Promise<void> {
checkCoinConfig(cfg, basic);
- checkWireConfig(cfg);
+ await checkWireConfig(cfg);
- checkAggregatorConfig(cfg);
+ await checkAggregatorConfig(cfg);
- checkCloserConfig(cfg);
+ await checkCloserConfig(cfg);
const pubConf = checkMasterPublicKeyConfig(cfg);