libeufin tutorial test: check sandbox step

This commit is contained in:
MS 2021-02-03 14:34:31 +01:00
parent d8c4b2734e
commit a3b84dca53
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
3 changed files with 39 additions and 4 deletions

View File

@ -136,6 +136,7 @@ export async function sh(
t: GlobalTestState,
logName: string,
command: string,
env: { [index: string]: string | undefined } = process.env,
): Promise<string> {
console.log("runing command", command);
return new Promise((resolve, reject) => {
@ -143,6 +144,7 @@ export async function sh(
const proc = spawn(command, {
stdio: ["inherit", "pipe", "pipe"],
shell: true,
env: env,
});
proc.stdout.on("data", (x) => {
if (x instanceof Buffer) {

View File

@ -25,6 +25,7 @@ import {
ProcessWrapper,
runCommand,
extendEnv,
sh,
} from "./harness";
export interface LibeufinSandboxServiceInterface {
@ -45,6 +46,13 @@ export interface LibeufinNexusConfig {
databaseJdbcUri: string;
}
export interface LibeufinCliDetails {
nexusUrl: string;
sandboxUrl: string;
nexusDatabaseUri: string;
sandboxDatabaseUri: string;
}
export class LibeufinSandboxService implements LibeufinSandboxServiceInterface {
static async create(
gc: GlobalTestState,
@ -171,6 +179,25 @@ export interface SimulateIncomingTransactionRequest {
currency: string;
}
export class LibeufinCli {
cliDetails: LibeufinCliDetails;
globalTestState: GlobalTestState;
constructor(gc: GlobalTestState, cd: LibeufinCliDetails) {
this.globalTestState = gc;
this.cliDetails = cd;
}
async checkSandbox(): Promise<void> {
await sh(
this.globalTestState,
"libeufin-cli-checksandbox",
"libeufin-cli sandbox check",
extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }),
);
}
}
export namespace LibeufinSandboxApi {
export async function createEbicsHost(
libeufinSandboxService: LibeufinSandboxServiceInterface,

View File

@ -19,17 +19,15 @@
*/
import { CoreApiResponse } from "@gnu-taler/taler-wallet-core";
import { CoinConfig, defaultCoinConfig } from "./denomStructures";
import {
GlobalTestState,
} from "./harness";
import { GlobalTestState } from "./harness";
import {
LibeufinNexusApi,
LibeufinNexusService,
LibeufinSandboxApi,
LibeufinSandboxService,
LibeufinCli,
} from "./libeufin";
/**
* Run basic test with LibEuFin.
*/
@ -52,4 +50,12 @@ export async function runLibeufinTutorialTest(t: GlobalTestState) {
await libeufinNexus.start();
await libeufinNexus.pingUntilAvailable();
const libeufinCli = new LibeufinCli(t, {
sandboxUrl: libeufinSandbox.baseUrl,
nexusUrl: libeufinNexus.baseUrl,
sandboxDatabaseUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`,
nexusDatabaseUri: `jdbc:sqlite:${t.testDir}/libeufin-nexus.sqlite3`,
});
await libeufinCli.checkSandbox();
}