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) => {
logger.trace("This is a trace message.");
logger.info("This is an info message.");
@ -248,6 +247,9 @@ testingCli
if (t.excludeByDefault) {
s += ` [excluded by default]`;
}
if (t.experimental) {
s += ` [experimental]`;
}
console.log(s);
}
});
@ -263,6 +265,9 @@ testingCli
.flag("dryRun", ["--dry"], {
help: "Only print tests that will be selected to run.",
})
.flag("experimental", ["--experimental"], {
help: "Include tests marked as experimental",
})
.flag("quiet", ["--quiet"], {
help: "Produce less output.",
})
@ -272,6 +277,7 @@ testingCli
suiteSpec: args.runIntegrationtests.suites,
dryRun: args.runIntegrationtests.dryRun,
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,
{},
);
console.log("transactions", JSON.stringify(transactions, undefined, 2));
t.assertDeepEqual(transactions.transactions[0].type, "withdrawal");
t.assertTrue(!transactions.transactions[0].pending);
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
// deposit and wire fees.
t.assertDeepEqual(transactions.transactions[1].amountRaw, "TESTKUDOS:9.79");

View File

@ -202,3 +202,5 @@ export async function runKycTest(t: GlobalTestState) {
}
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"];
// 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"];
// See https://bugs.taler.net/n/7598
runWalletBackupDoublespendTest.experimental = true;

View File

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

View File

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

View File

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

View File

@ -200,13 +200,22 @@ async function gatherDepositPending(
if (dg.timestampFinished) {
return;
}
let deposited = true;
for (const d of dg.depositedPerCoin) {
if (!d) {
deposited = false;
}
}
const opId = RetryTags.forDeposit(dg);
const retryRecord = await tx.operationRetries.get(opId);
const timestampDue = retryRecord?.retryInfo.nextRetry ?? AbsoluteTime.now();
resp.pendingOperations.push({
type: PendingTaskType.Deposit,
...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,
lastError: retryRecord?.lastError,
retryInfo: retryRecord?.retryInfo,

View File

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

View File

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

View File

@ -1350,7 +1350,7 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
{
amount: Amounts.stringify(amount),
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());