diff options
author | Florian Dold <florian@dold.me> | 2021-03-02 14:19:01 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-03-02 14:19:01 +0100 |
commit | 98ab998a1ecf495e85fcc73a29ca88d990415f05 (patch) | |
tree | fdc7555044908bc841793cf18787300af1062543 /packages/taler-wallet-cli | |
parent | f11a194d1090891f3509f6a52b410926527b099e (diff) | |
download | wallet-core-98ab998a1ecf495e85fcc73a29ca88d990415f05.tar.xz |
implement test suites
Diffstat (limited to 'packages/taler-wallet-cli')
4 files changed, 36 insertions, 4 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index 5e0d72208..acf46526f 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -797,9 +797,17 @@ testCli .maybeArgument("pattern", clk.STRING, { help: "Glob pattern to select which tests to run", }) + .maybeOption("suites", ["--suites"], clk.STRING, { + help: "Only run selected suites (string-separated list)" + }) + .flag("dryRun", ["--dry"], { + help: "Only print tests that will be selected to run." + }) .action(async (args) => { await runTests({ - include_pattern: args.runIntegrationtests.pattern, + includePattern: args.runIntegrationtests.pattern, + suiteSpec: args.runIntegrationtests.suites, + dryRun: args.runIntegrationtests.dryRun, }); }); diff --git a/packages/taler-wallet-cli/src/integrationtests/harness.ts b/packages/taler-wallet-cli/src/integrationtests/harness.ts index 518326f93..2fe976f9c 100644 --- a/packages/taler-wallet-cli/src/integrationtests/harness.ts +++ b/packages/taler-wallet-cli/src/integrationtests/harness.ts @@ -1408,7 +1408,7 @@ export class MerchantService implements MerchantServiceInterface { console.log("adding instance"); const url = `http://localhost:${this.merchantConfig.httpPort}/private/instances`; await axios.post(url, { - auth_token: instanceConfig.authToken, + auth: { method: "external" }, payto_uris: instanceConfig.paytoUris, id: instanceConfig.id, name: instanceConfig.name, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts index 15b548cc0..a60f7f015 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts @@ -228,3 +228,5 @@ export async function runMerchantExchangeConfusionTest(t: GlobalTestState) { t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done); } + +runMerchantExchangeConfusionTest.suites = ["merchant"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts index a11b45878..252dbafb6 100644 --- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts +++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts @@ -70,6 +70,7 @@ import CancellationToken from "cancellationtoken"; interface TestMainFunction { (t: GlobalTestState): Promise<void>; timeoutMs?: number; + suites?: string[]; } const allTests: TestMainFunction[] = [ @@ -108,7 +109,9 @@ const allTests: TestMainFunction[] = [ ]; export interface TestRunSpec { - include_pattern?: string; + includePattern?: string; + suiteSpec?: string; + dryRun?: boolean, } export interface TestInfo { @@ -171,9 +174,28 @@ export async function runTests(spec: TestRunSpec) { //process.on("unhandledRejection", handleSignal); //process.on("uncaughtException", handleSignal); + let suites: Set<string> | undefined; + + if (spec.suiteSpec) { + suites = new Set(spec.suiteSpec.split(",").map((x) => x.trim())); + } + for (const [n, testCase] of allTests.entries()) { const testName = getTestName(testCase); - if (spec.include_pattern && !M(testName, spec.include_pattern)) { + if (spec.includePattern && !M(testName, spec.includePattern)) { + continue; + } + + if (suites) { + const ts = new Set(testCase.suites ?? []); + const intersection = new Set([...suites].filter((x) => ts.has(x))); + if (intersection.size === 0) { + continue; + } + } + + if (spec.dryRun) { + console.log(`dry run: would run test ${testName}`); continue; } |