libeufin tutorial test: check sandbox step
This commit is contained in:
parent
d8c4b2734e
commit
a3b84dca53
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user