diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-17 08:39:18 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-17 08:39:18 +0100 |
commit | cd1270a53dfbd503ce8b5ab8b52d29c84a443339 (patch) | |
tree | 07ba11b8a3bf00c9b938c8edc4ca646abbba1fc6 /src/testing | |
parent | 33d4369dcf89e8868177e38e1a485002ce975005 (diff) |
-misc fixes wrt long polling
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_merchant_api.c | 37 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_get_orders.c | 2 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_kyc_get.c | 18 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_pay_order.c | 2 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wallet_get_order.c | 4 |
5 files changed, 41 insertions, 22 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index 93c3af55..67dea30f 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -36,6 +36,22 @@ #include <taler/taler_error_codes.h> #include "taler_merchant_testing_lib.h" + +/** + * The 'poll-orders-conclude-1' and other 'conclude' + * commands should NOT wait for this timeout! + */ +#define POLL_ORDER_TIMEOUT \ + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) + +/** + * The 'poll-orders-conclude-1x' and other 'conclude' + * commands that should (!) wait for this timeout! Hence, + * here we use a short value! + */ +#define POLL_ORDER_SHORT_TIMEOUT \ + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2) + /** * Configuration file we use. One (big) configuration is used * for the various components for this test. @@ -206,14 +222,12 @@ run (void *cls, PAYTO_I1, "EUR", MHD_HTTP_NO_CONTENT), -#if FIXME TALER_TESTING_cmd_merchant_kyc_get ("instance-create-kyc-0", merchant_url, NULL, NULL, EXCHANGE_URL, - MHD_HTTP_OK), -#endif + MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_orders_no_claim ("create-proposal-4", merchant_url, MHD_HTTP_OK, @@ -280,7 +294,7 @@ run (void *cls, MHD_HTTP_NOT_FOUND), TALER_TESTING_cmd_poll_orders_start ("poll-orders-1-start", merchant_url, - GNUNET_TIME_UNIT_MINUTES), + POLL_ORDER_TIMEOUT), TALER_TESTING_cmd_merchant_claim_order ("claim-order-nx", merchant_url, MHD_HTTP_NOT_FOUND, @@ -369,18 +383,18 @@ run (void *cls, TALER_TESTING_cmd_wallet_poll_order_start ("poll-order-wallet-start-1", merchant_url, "create-proposal-1", - GNUNET_TIME_UNIT_MINUTES, + POLL_ORDER_TIMEOUT, NULL), TALER_TESTING_cmd_wallet_poll_order_start2 ("poll-order-wallet-start-1x", merchant_url, "create-proposal-1x", - GNUNET_TIME_UNIT_MINUTES, - NULL, + POLL_ORDER_SHORT_TIMEOUT, + NULL, /* no refund */ "session-0"), TALER_TESTING_cmd_poll_order_start ("poll-order-merchant-1-start", merchant_url, "1", - GNUNET_TIME_UNIT_MINUTES), + POLL_ORDER_TIMEOUT), TALER_TESTING_cmd_merchant_pay_order ("deposit-simple", merchant_url, MHD_HTTP_OK, @@ -396,6 +410,7 @@ run (void *cls, MHD_HTTP_OK, NULL, "poll-order-wallet-start-1"), + /* Here we expect to run into a timeout, as we do not pay this one */ TALER_TESTING_cmd_wallet_poll_order_conclude2 ("poll-order-1x-conclude", MHD_HTTP_OK, NULL, @@ -708,13 +723,13 @@ run (void *cls, TALER_TESTING_cmd_wallet_poll_order_start ("poll-order-wallet-refund-1-low", merchant_url, "create-proposal-1r", - GNUNET_TIME_UNIT_MINUTES, + POLL_ORDER_TIMEOUT, "EUR:0.01"), TALER_TESTING_cmd_wallet_poll_order_start ( "poll-order-wallet-refund-1-high", merchant_url, "create-proposal-1r", - GNUNET_TIME_UNIT_MINUTES, + POLL_ORDER_TIMEOUT, "EUR:0.2"), TALER_TESTING_cmd_merchant_pay_order ("pay-for-refund-1r", merchant_url, @@ -727,7 +742,7 @@ run (void *cls, TALER_TESTING_cmd_poll_order_start ("poll-payment-refund-1", merchant_url, "1r", /* proposal name, not cmd ref! */ - GNUNET_TIME_UNIT_MINUTES), + POLL_ORDER_TIMEOUT), TALER_TESTING_cmd_merchant_order_refund ("refund-increase-1r", merchant_url, "refund test", diff --git a/src/testing/testing_api_cmd_get_orders.c b/src/testing/testing_api_cmd_get_orders.c index 479faac9..6e1ca622 100644 --- a/src/testing/testing_api_cmd_get_orders.c +++ b/src/testing/testing_api_cmd_get_orders.c @@ -525,7 +525,7 @@ TALER_TESTING_cmd_poll_orders_start (const char *label, /** - * Run the "GET orders" CMD. + * Wait for the "GET orders" CMD to complete. * * @param cls closure. * @param cmd command being run now. diff --git a/src/testing/testing_api_cmd_kyc_get.c b/src/testing/testing_api_cmd_kyc_get.c index 32378177..0d7a405e 100644 --- a/src/testing/testing_api_cmd_kyc_get.c +++ b/src/testing/testing_api_cmd_kyc_get.c @@ -83,7 +83,7 @@ struct KycGetState */ static void kyc_get_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct KycGetState *cs = cls; @@ -109,8 +109,12 @@ kyc_get_cb (void *cls, struct KycGetState *cs = cls; cs->kgh = NULL; - if (kr->hr.exchange_http_status != cs->expected_http_status) + if (kr->hr.http_status != cs->expected_http_status) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Expected status %u, got %u\n", + cs->expected_http_status, + kr->hr.http_status); TALER_TESTING_FAIL (cs->is); } TALER_TESTING_interpreter_next (cs->is); @@ -126,8 +130,8 @@ kyc_get_cb (void *cls, */ static void kyc_get_run (void *cls, - const struct TALER_TESTING_Command *cmd, - struct TALER_TESTING_Interpreter *is) + const struct TALER_TESTING_Command *cmd, + struct TALER_TESTING_Interpreter *is) { struct KycGetState *cs = cls; const struct TALER_MerchantWireHash *h_wire = NULL; @@ -138,9 +142,9 @@ kyc_get_run (void *cls, const struct TALER_TESTING_Command *wire_cmd; if (NULL == - (wire_cmd = - TALER_TESTING_interpreter_lookup_command (cs->is, - cs->h_wire_ref))) + (wire_cmd = + TALER_TESTING_interpreter_lookup_command (cs->is, + cs->h_wire_ref))) { GNUNET_break (0); TALER_TESTING_FAIL (cs->is); diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c index 697f0694..6087ef2b 100644 --- a/src/testing/testing_api_cmd_pay_order.c +++ b/src/testing/testing_api_cmd_pay_order.c @@ -416,7 +416,7 @@ pay_cleanup (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue pay_traits (void *cls, const void **ret, const char *trait, diff --git a/src/testing/testing_api_cmd_wallet_get_order.c b/src/testing/testing_api_cmd_wallet_get_order.c index 1d43c20e..faa0a77d 100644 --- a/src/testing/testing_api_cmd_wallet_get_order.c +++ b/src/testing/testing_api_cmd_wallet_get_order.c @@ -106,7 +106,6 @@ wallet_get_order_cb ( const char *taler_pay_uri, const char *already_paid_order_id) { - /* FIXME, deeper checks should be implemented here. */ struct WalletGetOrderState *gos = cls; bool paid_b = (paid == GNUNET_YES); bool refunded_b = (refunded == GNUNET_YES); @@ -616,7 +615,8 @@ wallet_poll_order_cb ( "Unhandled HTTP status.\n"); break; } - if (NULL != pos->cs) + if ( (NULL != pos->cs) && + (NULL != pos->cs->task) ) { GNUNET_SCHEDULER_cancel (pos->cs->task); pos->cs->task = GNUNET_SCHEDULER_add_now (&conclude_task, |