summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-20 21:49:28 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-20 21:49:28 +0200
commit7966a22f35266e7a607b08ef4975e0a09e31e0ae (patch)
tree0b76a6b63893df0790f88d8d987302a6cc4b889f
parentc4b37438f88051d4271af0b3db3aed6deb6ec3d8 (diff)
downloadsync-7966a22f35266e7a607b08ef4975e0a09e31e0ae.tar.gz
sync-7966a22f35266e7a607b08ef4975e0a09e31e0ae.tar.bz2
sync-7966a22f35266e7a607b08ef4975e0a09e31e0ae.zip
-fix sync testv0.9.3-dev.2
-rw-r--r--src/testing/test_sync_api.c144
-rw-r--r--src/testing/test_sync_api.conf86
2 files changed, 41 insertions, 189 deletions
diff --git a/src/testing/test_sync_api.c b/src/testing/test_sync_api.c
index 70c94b8..e9f4938 100644
--- a/src/testing/test_sync_api.c
+++ b/src/testing/test_sync_api.c
@@ -80,32 +80,17 @@ static char *merchant_payto;
/**
* Configuration of the bank.
*/
-static struct TALER_TESTING_BankConfiguration bc;
-
-/**
- * Configuration of the exchange.
- */
-static struct TALER_TESTING_ExchangeConfiguration ec;
+static struct TALER_TESTING_Credentials cred;
/**
* Merchant base URL.
*/
-static char *merchant_url;
+static const char *merchant_url = "http://localhost:8080/";
/**
* Sync base URL.
*/
-static char *sync_url;
-
-/**
- * Merchant process.
- */
-static struct GNUNET_OS_Process *merchantd;
-
-/**
- * Sync-httpd process.
- */
-static struct GNUNET_OS_Process *syncd;
+static const char *sync_url = "http://localhost:8084/";
/**
@@ -136,7 +121,7 @@ cmd_transfer_to_exchange (const char *label,
{
return TALER_TESTING_cmd_admin_add_incoming (label,
amount,
- &bc.exchange_auth,
+ &cred.ba,
payer_payto);
}
@@ -152,22 +137,19 @@ run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct TALER_TESTING_Command commands[] = {
- /* general setup */
- TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
- MHD_HTTP_NO_CONTENT,
- false),
- TALER_TESTING_cmd_wire_add ("add-wire-account",
- "payto://x-taler-bank/localhost/2",
- MHD_HTTP_NO_CONTENT,
- false),
- TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
- CONFIG_FILE),
- TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
- CONFIG_FILE,
- "EUR:0.01",
- "EUR:0.01"),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
- 1),
+ TALER_TESTING_cmd_run_fakebank ("run-fakebank",
+ cred.cfg,
+ "exchange-account-exchange"),
+ TALER_TESTING_cmd_system_start ("start-taler",
+ CONFIG_FILE,
+ "-emb",
+ "-u", "exchange-account-exchange",
+ NULL),
+ TALER_TESTING_cmd_get_exchange ("get-exchange",
+ cred.cfg,
+ true,
+ true),
+ TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
merchant_url,
"default",
@@ -272,9 +254,8 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
- TALER_TESTING_run_with_fakebank (is,
- commands,
- bc.exchange_auth.wire_gateway_url);
+ TALER_TESTING_run (is,
+ commands);
}
@@ -282,76 +263,23 @@ int
main (int argc,
char *const *argv)
{
- unsigned int ret;
- /* These environment variables get in the way... */
- unsetenv ("XDG_DATA_HOME");
- unsetenv ("XDG_CONFIG_HOME");
-
- GNUNET_log_setup ("test-sync-api",
- "DEBUG",
- NULL);
- if (GNUNET_OK !=
- TALER_TESTING_prepare_fakebank (CONFIG_FILE,
- "exchange-account-exchange",
- &bc))
- return 77;
- payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME);
- exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME);
- merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME);
- if (NULL ==
- (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE)))
- return 77;
- TALER_TESTING_cleanup_files (CONFIG_FILE);
-
- if (NULL ==
- (sync_url = SYNC_TESTING_prepare_sync (CONFIG_FILE)))
- return 77;
-
- TALER_TESTING_cleanup_files (CONFIG_FILE);
-
- switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
- GNUNET_YES,
- &ec))
- {
- case GNUNET_SYSERR:
- GNUNET_break (0);
- return 1;
- case GNUNET_NO:
- return 77;
-
- case GNUNET_OK:
-
- if (NULL == (merchantd =
- TALER_TESTING_run_merchant (CONFIG_FILE,
- merchant_url)))
- return 1;
-
- if (NULL == (syncd =
- SYNC_TESTING_run_sync (CONFIG_FILE,
- sync_url)))
- return 1;
-
- ret = TALER_TESTING_setup_with_exchange (&run,
- NULL,
- CONFIG_FILE);
-
- GNUNET_OS_process_kill (merchantd, SIGTERM);
- GNUNET_OS_process_kill (syncd, SIGTERM);
- GNUNET_OS_process_wait (merchantd);
- GNUNET_OS_process_wait (syncd);
- GNUNET_OS_process_destroy (merchantd);
- GNUNET_OS_process_destroy (syncd);
- GNUNET_free (merchant_url);
- GNUNET_free (sync_url);
-
- if (GNUNET_OK != ret)
- return 1;
- break;
- default:
- GNUNET_break (0);
- return 1;
- }
- return 0;
+ (void) argc;
+ payer_payto =
+ "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME "?receiver-name=user";
+ exchange_payto =
+ "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME
+ "?receiver-name=exchange";
+ merchant_payto =
+ "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME
+ "?receiver-name=merchant";
+ return TALER_TESTING_main (argv,
+ "DEBUG",
+ CONFIG_FILE,
+ "exchange-account-exchange",
+ TALER_TESTING_BS_FAKEBANK,
+ &cred,
+ &run,
+ NULL);
}
diff --git a/src/testing/test_sync_api.conf b/src/testing/test_sync_api.conf
index 8574648..195cd30 100644
--- a/src/testing/test_sync_api.conf
+++ b/src/testing/test_sync_api.conf
@@ -1,86 +1,45 @@
# This file is in the public domain.
#
[PATHS]
-# Persistent data storage for the testcase
TALER_TEST_HOME = test_sync_api_home/
TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/
-
-# Persistent data storage
TALER_DATA_HOME = $TALER_HOME/.local/share/taler/
-
-# Configuration files
TALER_CONFIG_HOME = $TALER_HOME/.config/taler/
-
-# Cached data, no big deal if lost
TALER_CACHE_HOME = $TALER_HOME/.cache/taler/
[taler]
-# What currency do we use?
CURRENCY = EUR
CURRENCY_ROUND_UNIT = EUR:0.01
[taler-helper-crypto-rsa]
-# Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days
[taler-helper-crypto-eddsa]
-# Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days
-# Reduce from 12 weeks to ensure we have multiple
DURATION = 14 days
[bank]
HTTP_PORT = 8082
-# Sync config
-
[sync]
-AML_THRESHOLD = EUR:1000000
-
-# Which port do we run the *sync* backend on? (HTTP server)
PORT = 8084
-
-# Where does our payment backend run? Must match PORT under [merchant]
-PAYMENT_BACKEND_URL = http://localhost:8080/
-
-# Annual fee we charge.
+PAYMENT_BACKEND_URL = "http://localhost:8080/"
ANNUAL_FEE = EUR:4.99
-
-# Upload limit
UPLOAD_LIMIT_MB = 1
[syncdb-postgres]
CONFIG = postgres:///synccheck
-
-# Where are the SQL files to setup our tables?
-# Important: this MUST end with a "/"!
SQL_DIR = $DATADIR/sql/
-##########################################
-# Configuration for the merchant backend #
-##########################################
-
[merchant]
-# Which port do we run the backend on? (HTTP server)
PORT = 8080
-
-# How quickly do we want the exchange to send us our money?
-# Used only if the frontend does not specify a value.
WIRE_TRANSFER_DELAY = 0 s
-
-# Which plugin (backend) do we use for the DB.
DB = postgres
-
-# Default choice for maximum wire fee.
DEFAULT_MAX_WIRE_FEE = EUR:0.10
-
-# Default choice for maximum deposit fee.
DEFAULT_MAX_DEPOSIT_FEE = EUR:0.10
-
-# This specifies which database the postgres backend uses.
[merchantdb-postgres]
-CONFIG = postgres:///talercheck
+CONFIG = postgres:///synccheck
# Different instances operated by this merchant:
[instance-default]
@@ -97,54 +56,19 @@ CURRENCY = EUR
[auditor]
BASE_URL = http://the.auditor/
-# Auditors must be in sections "auditor-", the rest of the section
-# name could be anything.
-[auditor-ezb]
-# Informal name of the auditor. Just for the user.
-NAME = European Central Bank
-
-# URL of the auditor (especially for in the future, when the
-# auditor offers an automated issue reporting system).
-# Not really used today.
-URL = http://taler.ezb.eu/
-
-# This is the important bit: the signing key of the auditor.
-PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60
-
-# Which currency is this auditor trusted for?
-CURRENCY = EUR
-
-
-###################################################
-# Configuration for the exchange for the testcase #
-###################################################
-
[exchange]
-# How to access our database
+AML_THRESHOLD = EUR:1000000
DB = postgres
-
-# HTTP port the exchange listens to
PORT = 8081
-
-# How long are signing keys valid?
SIGNKEY_LEGAL_DURATION = 2 years
-
-# Our public key
MASTER_PUBLIC_KEY = EAQTXN8S6QP081WRWG03N8SQ34PX492ATXSSWASJGRXCBP0QM7HG
-
-# Base URL of the exchange.
BASE_URL = "http://localhost:8081/"
[exchangedb-postgres]
-CONFIG = "postgres:///talercheck"
-
-[auditordb-postgres]
-CONFIG = postgres:///talercheck
+CONFIG = "postgres:///synccheck"
-# Account of the EXCHANGE
[exchange-account-exchange]
-# What is the exchange's bank account (with the "Taler Bank" demo system)?
-PAYTO_URI = "payto://x-taler-bank/localhost:8082/2"
+PAYTO_URI = "payto://x-taler-bank/localhost:8082/2?receiver-name=exchange"
ENABLE_DEBIT = YES
ENABLE_CREDIT = YES