diff options
author | Florian Dold <florian@dold.me> | 2021-01-05 17:59:50 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-01-05 17:59:50 +0100 |
commit | c032931f22e4d1b44e2a3af52c705db147129024 (patch) | |
tree | 49da75982f72796724b6f03e8e513d85f0c11466 /packages/taler-integrationtests/src | |
parent | 981ef46267e0b1768b455307ab783874c3006262 (diff) |
get basic test cases to work with new exchange
Diffstat (limited to 'packages/taler-integrationtests/src')
-rw-r--r-- | packages/taler-integrationtests/src/harness.ts | 116 |
1 files changed, 93 insertions, 23 deletions
diff --git a/packages/taler-integrationtests/src/harness.ts b/packages/taler-integrationtests/src/harness.ts index 1dd6c7c6f..ebf1e98d9 100644 --- a/packages/taler-integrationtests/src/harness.ts +++ b/packages/taler-integrationtests/src/harness.ts @@ -414,6 +414,7 @@ export interface BankConfig { function setPaths(config: Configuration, home: string) { config.setString("paths", "taler_home", home); + config.setString("paths", "taler_runtime_dir", "$TALER_HOME/taler-runtime/"); config.setString( "paths", "taler_data_home", @@ -851,7 +852,7 @@ export class ExchangeService implements ExchangeServiceInterface { config.setString("exchange", "max_keys_caching", "forever"); config.setString("exchange", "db", "postgres"); config.setString( - "exchange", + "exchange-offline", "master_priv_file", "${TALER_DATA_HOME}/exchange/offline-keys/master.priv", ); @@ -862,19 +863,6 @@ export class ExchangeService implements ExchangeServiceInterface { config.setString("exchange", "lookahead_sign", "32 weeks 1 day"); config.setString("exchange", "lookahead_provide", "4 weeks 1 day"); - for (let i = 2020; i < 2029; i++) { - config.setString( - "fees-x-taler-bank", - `wire-fee-${i}`, - `${e.currency}:0.01`, - ); - config.setString( - "fees-x-taler-bank", - `closing-fee-${i}`, - `${e.currency}:0.01`, - ); - } - config.setString("exchangedb-postgres", "config", e.database); const exchangeMasterKey = createEddsaKeyPair(); @@ -886,7 +874,7 @@ export class ExchangeService implements ExchangeServiceInterface { ); const masterPrivFile = config - .getPath("exchange", "master_priv_file") + .getPath("exchange-offline", "master_priv_file") .required(); fs.mkdirSync(path.dirname(masterPrivFile), { recursive: true }); @@ -963,6 +951,9 @@ export class ExchangeService implements ExchangeServiceInterface { exchangeHttpProc: ProcessWrapper | undefined; exchangeWirewatchProc: ProcessWrapper | undefined; + helperCryptoRsaProc: ProcessWrapper | undefined; + helperCryptoEddsaProc: ProcessWrapper | undefined; + constructor( private globalState: GlobalTestState, private exchangeConfig: ExchangeConfig, @@ -995,14 +986,85 @@ export class ExchangeService implements ExchangeServiceInterface { await httpd.wait(); this.exchangeHttpProc = undefined; } + const cryptoRsa = this.helperCryptoRsaProc; + if (cryptoRsa) { + cryptoRsa.proc.kill("SIGTERM"); + await cryptoRsa.wait(); + this.helperCryptoRsaProc = undefined; + } + const cryptoEddsa = this.helperCryptoEddsaProc; + if (cryptoEddsa) { + cryptoEddsa.proc.kill("SIGTERM"); + await cryptoEddsa.wait(); + this.helperCryptoRsaProc = undefined; + } } + /** + * Update keys signing the keys generated by the security module + * with the offline signing key. + */ async keyup(): Promise<void> { - await sh( + await runCommand( this.globalState, - "exchange-keyup", - `taler-exchange-keyup ${this.timetravelArg} -c "${this.configFilename}"`, + "exchange-offline", + "taler-exchange-offline", + [ + "-c", + this.configFilename, + ...this.timetravelArgArr, + "download", + "sign", + "upload", + ], ); + + const accounts: string[] = []; + + const config = Configuration.load(this.configFilename); + for (const sectionName of config.getSectionNames()) { + if (sectionName.startsWith("exchange-account")) { + accounts.push(config.getString(sectionName, "payto_uri").required()); + } + } + + console.log("configuring bank accounts", accounts); + + for (const acc of accounts) { + await runCommand( + this.globalState, + "exchange-offline", + "taler-exchange-offline", + [ + "-c", + this.configFilename, + ...this.timetravelArgArr, + "enable-account", + acc, + "upload", + ], + ); + } + + const year = new Date().getFullYear(); + for (let i = year; i < year+5; i++) { + await runCommand( + this.globalState, + "exchange-offline", + "taler-exchange-offline", + [ + "-c", + this.configFilename, + ...this.timetravelArgArr, + "wire-fee", + `${i}`, + "x-taler-bank", + `${this.exchangeConfig.currency}:0.01`, + `${this.exchangeConfig.currency}:0.01`, + "upload", + ], + ); + } } async revokeDenomination(denomPubHash: string) { @@ -1032,11 +1094,17 @@ export class ExchangeService implements ExchangeServiceInterface { "exchange-dbinit", `taler-exchange-dbinit -c "${this.configFilename}"`, ); - await this.keyup(); - await sh( - this.globalState, - "exchange-wire", - `taler-exchange-wire ${this.timetravelArg} -c "${this.configFilename}"`, + + this.helperCryptoEddsaProc = this.globalState.spawnService( + "taler-helper-crypto-eddsa", + ["-c", this.configFilename, ...this.timetravelArgArr], + `exchange-crypto-eddsa-${this.name}`, + ); + + this.helperCryptoRsaProc = this.globalState.spawnService( + "taler-helper-crypto-rsa", + ["-c", this.configFilename, ...this.timetravelArgArr], + `exchange-crypto-rsa-${this.name}`, ); this.exchangeWirewatchProc = this.globalState.spawnService( @@ -1056,6 +1124,8 @@ export class ExchangeService implements ExchangeServiceInterface { ], `exchange-httpd-${this.name}`, ); + + await this.keyup(); } async pingUntilAvailable(): Promise<void> { |