harness: fix exchange base URL in tests with fault injection

This commit is contained in:
Florian Dold 2023-06-21 06:59:34 +02:00
parent 34e2fd51e0
commit 7dcfd02dae
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
4 changed files with 22 additions and 3 deletions

View File

@ -406,6 +406,11 @@ export async function createFaultInjectedMerchantTestkudosEnvironment(
const faultyMerchant = new FaultInjectedMerchantService(t, merchant, 9083); const faultyMerchant = new FaultInjectedMerchantService(t, merchant, 9083);
const faultyExchange = new FaultInjectedExchangeService(t, exchange, 9081); const faultyExchange = new FaultInjectedExchangeService(t, exchange, 9081);
// Base URL must contain port that the proxy is listening on.
await exchange.modifyConfig(async (config) => {
config.setString("exchange", "base_url", "http://localhost:9081/");
});
const exchangeBankAccount = await bank.createExchangeAccount( const exchangeBankAccount = await bank.createExchangeAccount(
"myexchange", "myexchange",
"x", "x",
@ -546,8 +551,9 @@ export async function withdrawViaBankV2(
}, },
); );
const withdrawalFinishedCond = wallet.waitForNotificationCond((x) => const withdrawalFinishedCond = wallet.waitForNotificationCond(
x.type === NotificationType.TransactionStateTransition && (x) =>
x.type === NotificationType.TransactionStateTransition &&
x.newTxState.major === TransactionMajorState.Done && x.newTxState.major === TransactionMajorState.Done &&
x.transactionId === acceptRes.transactionId, x.transactionId === acceptRes.transactionId,
); );

View File

@ -44,7 +44,7 @@ import {
import { defaultCoinConfig } from "../harness/denomStructures.js"; import { defaultCoinConfig } from "../harness/denomStructures.js";
/** /**
* Test if the wallet handles outdated exchange versions correct.y * Test if the wallet handles outdated exchange versions correctly.
*/ */
export async function runExchangeManagementTest( export async function runExchangeManagementTest(
t: GlobalTestState, t: GlobalTestState,
@ -81,6 +81,10 @@ export async function runExchangeManagementTest(
exchange.addBankAccount("1", exchangeBankAccount); exchange.addBankAccount("1", exchangeBankAccount);
const faultyExchange = new FaultInjectedExchangeService(t, exchange, 8091); 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( bank.setSuggestedExchange(
faultyExchange, faultyExchange,

View File

@ -79,6 +79,11 @@ export async function createConfusedMerchantTestkudosEnvironment(
const faultyMerchant = new FaultInjectedMerchantService(t, merchant, 9083); const faultyMerchant = new FaultInjectedMerchantService(t, merchant, 9083);
const faultyExchange = new FaultInjectedExchangeService(t, exchange, 9081); const faultyExchange = new FaultInjectedExchangeService(t, exchange, 9081);
// Base URL must contain port that the proxy is listening on.
await exchange.modifyConfig(async (config) => {
config.setString("exchange", "base_url", "http://localhost:9081/");
});
const exchangeBankAccount = await bank.createExchangeAccount( const exchangeBankAccount = await bank.createExchangeAccount(
"myexchange", "myexchange",
"x", "x",

View File

@ -84,6 +84,10 @@ export async function runPaymentFaultTest(t: GlobalTestState) {
await exchange.pingUntilAvailable(); await exchange.pingUntilAvailable();
const faultyExchange = new FaultInjectedExchangeService(t, exchange, 8091); 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 // Print all requests to the exchange
faultyExchange.faultProxy.addFault({ faultyExchange.faultProxy.addFault({