Merge branch 'master' of git.taler.net:wallet-core

This commit is contained in:
Sebastian 2023-01-18 17:32:34 -03:00
commit fdc7b58277
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
12 changed files with 51 additions and 6 deletions

View File

@ -229,7 +229,6 @@ deploymentConfigCli
); );
}); });
testingCli.subcommand("logtest", "logtest").action(async (args) => { testingCli.subcommand("logtest", "logtest").action(async (args) => {
logger.trace("This is a trace message."); logger.trace("This is a trace message.");
logger.info("This is an info message."); logger.info("This is an info message.");
@ -248,6 +247,9 @@ testingCli
if (t.excludeByDefault) { if (t.excludeByDefault) {
s += ` [excluded by default]`; s += ` [excluded by default]`;
} }
if (t.experimental) {
s += ` [experimental]`;
}
console.log(s); console.log(s);
} }
}); });
@ -263,6 +265,9 @@ testingCli
.flag("dryRun", ["--dry"], { .flag("dryRun", ["--dry"], {
help: "Only print tests that will be selected to run.", help: "Only print tests that will be selected to run.",
}) })
.flag("experimental", ["--experimental"], {
help: "Include tests marked as experimental",
})
.flag("quiet", ["--quiet"], { .flag("quiet", ["--quiet"], {
help: "Produce less output.", help: "Produce less output.",
}) })
@ -272,6 +277,7 @@ testingCli
suiteSpec: args.runIntegrationtests.suites, suiteSpec: args.runIntegrationtests.suites,
dryRun: args.runIntegrationtests.dryRun, dryRun: args.runIntegrationtests.dryRun,
verbosity: args.runIntegrationtests.quiet ? 0 : 1, verbosity: args.runIntegrationtests.quiet ? 0 : 1,
includeExperimental: args.runIntegrationtests.experimental ?? false,
}); });
}); });

View File

@ -54,11 +54,10 @@ export async function runDepositTest(t: GlobalTestState) {
WalletApiOperation.GetTransactions, WalletApiOperation.GetTransactions,
{}, {},
); );
console.log("transactions", JSON.stringify(transactions, undefined, 2)); console.log("transactions", JSON.stringify(transactions, undefined, 2));
t.assertDeepEqual(transactions.transactions[0].type, "withdrawal"); t.assertDeepEqual(transactions.transactions[0].type, "withdrawal");
t.assertTrue(!transactions.transactions[0].pending);
t.assertDeepEqual(transactions.transactions[1].type, "deposit"); t.assertDeepEqual(transactions.transactions[1].type, "deposit");
t.assertTrue(!transactions.transactions[1].pending);
// The raw amount is what ends up on the bank account, which includes // The raw amount is what ends up on the bank account, which includes
// deposit and wire fees. // deposit and wire fees.
t.assertDeepEqual(transactions.transactions[1].amountRaw, "TESTKUDOS:9.79"); t.assertDeepEqual(transactions.transactions[1].amountRaw, "TESTKUDOS:9.79");

View File

@ -202,3 +202,5 @@ export async function runKycTest(t: GlobalTestState) {
} }
runKycTest.suites = ["wallet"]; runKycTest.suites = ["wallet"];
// See bugs.taler.net/n/7599
runKycTest.experimental = true;

View File

@ -166,3 +166,5 @@ export async function runWalletBackupBasicTest(t: GlobalTestState) {
} }
runWalletBackupBasicTest.suites = ["wallet", "wallet-backup"]; runWalletBackupBasicTest.suites = ["wallet", "wallet-backup"];
// See https://bugs.taler.net/n/7598
runWalletBackupBasicTest.experimental = true;

View File

@ -172,3 +172,5 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) {
} }
runWalletBackupDoublespendTest.suites = ["wallet", "wallet-backup"]; runWalletBackupDoublespendTest.suites = ["wallet", "wallet-backup"];
// See https://bugs.taler.net/n/7598
runWalletBackupDoublespendTest.experimental = true;

View File

@ -111,6 +111,7 @@ interface TestMainFunction {
(t: GlobalTestState): Promise<void>; (t: GlobalTestState): Promise<void>;
timeoutMs?: number; timeoutMs?: number;
excludeByDefault?: boolean; excludeByDefault?: boolean;
experimental?: boolean;
suites?: string[]; suites?: string[];
} }
@ -194,6 +195,7 @@ export interface TestRunSpec {
includePattern?: string; includePattern?: string;
suiteSpec?: string; suiteSpec?: string;
dryRun?: boolean; dryRun?: boolean;
includeExperimental: boolean;
verbosity: number; verbosity: number;
} }
@ -201,6 +203,7 @@ export interface TestInfo {
name: string; name: string;
suites: string[]; suites: string[];
excludeByDefault: boolean; excludeByDefault: boolean;
experimental: boolean;
} }
function updateCurrentSymlink(testDir: string): void { function updateCurrentSymlink(testDir: string): void {
@ -284,6 +287,9 @@ export async function runTests(spec: TestRunSpec) {
if (testCase.excludeByDefault) { if (testCase.excludeByDefault) {
continue; continue;
} }
if (testCase.experimental && !spec.includeExperimental) {
continue;
}
} }
if (spec.dryRun) { if (spec.dryRun) {
@ -441,6 +447,7 @@ export function getTestInfo(): TestInfo[] {
name: getTestName(x), name: getTestName(x),
suites: x.suites ?? [], suites: x.suites ?? [],
excludeByDefault: x.excludeByDefault ?? false, excludeByDefault: x.excludeByDefault ?? false,
experimental: x.experimental ?? false,
})); }));
} }

View File

@ -550,6 +550,11 @@ export interface TransactionDeposit extends TransactionCommon {
wireTransferDeadline: TalerProtocolTimestamp; wireTransferDeadline: TalerProtocolTimestamp;
wireTransferProgress: number; wireTransferProgress: number;
/**
* Did all the deposit requests succeed?
*/
deposited: boolean;
} }
export interface TransactionByIdRequest { export interface TransactionByIdRequest {

View File

@ -21,7 +21,6 @@ import {
AbsoluteTime, AbsoluteTime,
AmountJson, AmountJson,
Amounts, Amounts,
bytesToString,
CancellationToken, CancellationToken,
canonicalJson, canonicalJson,
codecForDepositSuccess, codecForDepositSuccess,
@ -457,6 +456,8 @@ export async function prepareDepositGroup(
effectiveDepositAmount: Amounts.stringify(effectiveDepositAmount), effectiveDepositAmount: Amounts.stringify(effectiveDepositAmount),
}; };
} }
export async function createDepositGroup( export async function createDepositGroup(
ws: InternalWalletState, ws: InternalWalletState,
req: CreateDepositGroupRequest, req: CreateDepositGroupRequest,

View File

@ -200,13 +200,22 @@ async function gatherDepositPending(
if (dg.timestampFinished) { if (dg.timestampFinished) {
return; return;
} }
let deposited = true;
for (const d of dg.depositedPerCoin) {
if (!d) {
deposited = false;
}
}
const opId = RetryTags.forDeposit(dg); const opId = RetryTags.forDeposit(dg);
const retryRecord = await tx.operationRetries.get(opId); const retryRecord = await tx.operationRetries.get(opId);
const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now(); const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now();
resp.pendingOperations.push({ resp.pendingOperations.push({
type: PendingTaskType.Deposit, type: PendingTaskType.Deposit,
...getPendingCommon(ws, opId, timestampDue), ...getPendingCommon(ws, opId, timestampDue),
givesLifeness: true, // Fully deposited operations don't give lifeness,
// because there is no reason to wait on the
// deposit tracking status.
givesLifeness: !deposited,
depositGroupId: dg.depositGroupId, depositGroupId: dg.depositGroupId,
lastError: retryRecord?.lastError, lastError: retryRecord?.lastError,
retryInfo: retryRecord?.retryInfo, retryInfo: retryRecord?.retryInfo,

View File

@ -559,6 +559,12 @@ function buildTransactionForDeposit(
dg: DepositGroupRecord, dg: DepositGroupRecord,
ort?: OperationRetryRecord, ort?: OperationRetryRecord,
): Transaction { ): Transaction {
let deposited = true;
for (const d of dg.depositedPerCoin) {
if (!d) {
deposited = false;
}
}
return { return {
type: TransactionType.Deposit, type: TransactionType.Deposit,
amountRaw: Amounts.stringify(dg.effectiveDepositAmount), amountRaw: Amounts.stringify(dg.effectiveDepositAmount),
@ -583,6 +589,7 @@ function buildTransactionForDeposit(
)) / )) /
dg.transactionPerCoin.length, dg.transactionPerCoin.length,
depositGroupId: dg.depositGroupId, depositGroupId: dg.depositGroupId,
deposited,
...(ort?.lastError ? { error: ort.lastError } : {}), ...(ort?.lastError ? { error: ort.lastError } : {}),
}; };
} }

View File

@ -933,12 +933,17 @@ async function queryReserve(
cancellationToken, cancellationToken,
}); });
logger.info(`reserve status code: HTTP ${resp.status}`);
const result = await readSuccessResponseJsonOrErrorCode( const result = await readSuccessResponseJsonOrErrorCode(
resp, resp,
codecForReserveStatus(), codecForReserveStatus(),
); );
if (result.isError) { if (result.isError) {
logger.info(
`got reserve status error, EC=${result.talerErrorResponse.code}`,
);
if ( if (
resp.status === 404 && resp.status === 404 &&
result.talerErrorResponse.code === result.talerErrorResponse.code ===

View File

@ -1350,7 +1350,7 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
{ {
amount: Amounts.stringify(amount), amount: Amounts.stringify(amount),
reserve_pub: wres.reservePub, reserve_pub: wres.reservePub,
debit_account: "payto://x-taler-bank/localhost/testdebtor", debit_account: "payto://x-taler-bank/localhost/testdebtor?receiver-name=Foo",
}, },
); );
const fbResp = await readSuccessResponseJsonOrThrow(fbReq, codecForAny()); const fbResp = await readSuccessResponseJsonOrThrow(fbReq, codecForAny());