harness: wallet must always withdraw via fault-injected exchange
Otherwise, the ports in the base URL don't match and the wallet will complain.
This commit is contained in:
parent
9f8faed2d1
commit
ba913cd2ce
@ -43,12 +43,17 @@ const axios = axiosImp.default;
|
||||
export async function runPaymentAbortTest(t: GlobalTestState) {
|
||||
// Set up test environment
|
||||
|
||||
const { wallet, bank, exchange, faultyMerchant } =
|
||||
const { wallet, bank, exchange, faultyMerchant, faultyExchange } =
|
||||
await createFaultInjectedMerchantTestkudosEnvironment(t);
|
||||
|
||||
// Withdraw digital cash into the wallet.
|
||||
|
||||
await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" });
|
||||
await withdrawViaBank(t, {
|
||||
wallet,
|
||||
bank,
|
||||
exchange: faultyExchange,
|
||||
amount: "TESTKUDOS:20",
|
||||
});
|
||||
|
||||
const merchant = faultyMerchant;
|
||||
|
||||
@ -112,8 +117,6 @@ export async function runPaymentAbortTest(t: GlobalTestState) {
|
||||
publicOrderStatusResp.data,
|
||||
);
|
||||
|
||||
let faultInjected = false;
|
||||
|
||||
faultyMerchant.faultProxy.addFault({
|
||||
async modifyRequest(ctx: FaultInjectionRequestContext) {
|
||||
const url = new URL(ctx.requestUrl);
|
||||
|
@ -71,7 +71,16 @@ export async function runPaymentFaultTest(t: GlobalTestState) {
|
||||
"x",
|
||||
);
|
||||
|
||||
bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri);
|
||||
const faultyExchange = new FaultInjectedExchangeService(t, exchange, 8091);
|
||||
// Base URL must contain port that the proxy is listening on.
|
||||
await exchange.modifyConfig(async (config) => {
|
||||
config.setString("exchange", "base_url", "http://localhost:8091/");
|
||||
});
|
||||
|
||||
bank.setSuggestedExchange(
|
||||
faultyExchange,
|
||||
exchangeBankAccount.accountPaytoUri,
|
||||
);
|
||||
|
||||
await bank.start();
|
||||
|
||||
@ -83,12 +92,6 @@ export async function runPaymentFaultTest(t: GlobalTestState) {
|
||||
await exchange.start();
|
||||
await exchange.pingUntilAvailable();
|
||||
|
||||
const faultyExchange = new FaultInjectedExchangeService(t, exchange, 8091);
|
||||
// Base URL must contain port that the proxy is listening on.
|
||||
await exchange.modifyConfig(async (config) => {
|
||||
config.setString("exchange", "base_url", "http://localhost:8091/");
|
||||
});
|
||||
|
||||
// Print all requests to the exchange
|
||||
faultyExchange.faultProxy.addFault({
|
||||
async modifyRequest(ctx: FaultInjectionRequestContext) {
|
||||
|
@ -42,12 +42,17 @@ const axios = axiosImp.default;
|
||||
export async function runPaymentTransientTest(t: GlobalTestState) {
|
||||
// Set up test environment
|
||||
|
||||
const { wallet, bank, exchange, faultyMerchant } =
|
||||
const { wallet, bank, exchange, faultyMerchant, faultyExchange } =
|
||||
await createFaultInjectedMerchantTestkudosEnvironment(t);
|
||||
|
||||
// Withdraw digital cash into the wallet.
|
||||
|
||||
await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" });
|
||||
await withdrawViaBank(t, {
|
||||
wallet,
|
||||
bank,
|
||||
exchange: faultyExchange,
|
||||
amount: "TESTKUDOS:20",
|
||||
});
|
||||
|
||||
const merchant = faultyMerchant;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user