add missing files and adjust .gitignore rules for testing move

This commit is contained in:
Florian Dold 2020-01-19 16:06:29 +01:00
parent 03bcd50d9a
commit 9f522baadc
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
4 changed files with 1346 additions and 10 deletions

20
.gitignore vendored
View File

@ -42,10 +42,10 @@ src/bank-lib/test_bank_api_with_fakebank_twisted
src/bank-lib/test_bank_api_with_pybank_twisted src/bank-lib/test_bank_api_with_pybank_twisted
src/lib/test_exchange_api src/lib/test_exchange_api
src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/live-keys/ src/testing/test_taler_exchange_httpd_home/.local/share/taler/exchange/live-keys/
src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/wirefees/ src/testing/test_taler_exchange_httpd_home/.local/share/taler/exchange/wirefees/
src/lib/test_taler_exchange_httpd_home/.local/share/taler/auditor/ src/testing/test_taler_exchange_httpd_home/.local/share/taler/auditor/
src/lib/test_taler_exchange_httpd_home/.local/share/taler/auditors/ src/testing/test_taler_exchange_httpd_home/.local/share/taler/auditors/
src/testing/test_exchange_api_keys_cherry_picking_home/.local/share/taler/exchange/live-keys/ src/testing/test_exchange_api_keys_cherry_picking_home/.local/share/taler/exchange/live-keys/
src/testing/test_exchange_api_keys_cherry_picking_home/.local/share/taler/exchange/wirefees/ src/testing/test_exchange_api_keys_cherry_picking_home/.local/share/taler/exchange/wirefees/
@ -55,7 +55,7 @@ src/testing/test_exchange_api_home/.local/share/taler/exchange/live-keys/
src/testing/test_exchange_api_home/.local/share/taler/exchange/wirefees/ src/testing/test_exchange_api_home/.local/share/taler/exchange/wirefees/
src/testing/test_exchange_api_home/.local/share/taler/auditor/ src/testing/test_exchange_api_home/.local/share/taler/auditor/
src/testing/test_exchange_api_home/.local/share/taler/auditors/ src/testing/test_exchange_api_home/.local/share/taler/auditors/
src/lib/auditor.in src/testing/auditor.in
src/testing/test_exchange_api_twisted src/testing/test_exchange_api_twisted
src/exchange/taler-exchange-aggregator src/exchange/taler-exchange-aggregator
src/exchange/test_taler_exchange_aggregator-postgres src/exchange/test_taler_exchange_aggregator-postgres
@ -109,7 +109,7 @@ doc/manual/manual.vr
doc/prebuilt/* doc/prebuilt/*
contrib/taler-exchange.tag contrib/taler-exchange.tag
doxygen-doc/ doxygen-doc/
src/lib/test_exchange_api_keys_cherry_picking src/testing/test_exchange_api_keys_cherry_picking
src/auditor/taler-wire-auditor src/auditor/taler-wire-auditor
contrib/auditor-report.aux contrib/auditor-report.aux
contrib/auditor-report.log contrib/auditor-report.log
@ -117,10 +117,10 @@ contrib/auditor-report.tex
contrib/auditor-report.pdf contrib/auditor-report.pdf
src/bank-lib/taler-bank-transfer src/bank-lib/taler-bank-transfer
src/bank-lib/test_bank_api_twisted src/bank-lib/test_bank_api_twisted
src/lib/test_exchange_api src/testing/test_exchange_api
src/lib/test_auditor_api src/testing/test_auditor_api
src/lib/test_exchange_api_overlapping_keys_bug src/testing/test_exchange_api_overlapping_keys_bug
src/lib/test_exchange_api_home/.local/share/taler/exchange/revocations/ src/testing/test_exchange_api_home/.local/share/taler/exchange/revocations/
src/wire-plugins/test_wire_plugin_legacy_taler_bank src/wire-plugins/test_wire_plugin_legacy_taler_bank
uncrustify.cfg uncrustify.cfg
vgcore.* vgcore.*

View File

@ -0,0 +1,156 @@
/*
This file is part of TALER
(C) 2018 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3, or
(at your option) any later version.
TALER is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
*/
/**
* @file include/taler_twister_testing_lib.h
* @brief API for using twister-dependant test commands.
* @author Christian Grothoff <christian@grothoff.org>
* @author Marcello Stanisci
*/
#ifndef TALER_TWISTER_TESTING_LIB_H
#define TALER_TWISTER_TESTING_LIB_H
#include <taler/taler_testing_lib.h>
#define TWISTER_FAIL() \
do {GNUNET_break (0); return NULL; } while (0)
/**
* Define a "hack response code" CMD. This causes the next
* response code (from the service proxied by the twister) to
* be substituted with @a http_status.
*
* @param label command label
* @param config_filename configuration filename.
* @param http_status new response code to use
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_hack_response_code (const char *label,
const char *config_filename,
unsigned int http_status);
/**
* Create a "delete object" CMD. This command deletes
* the JSON object pointed by @a path.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to delete.
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_delete_object (const char *label,
const char *config_filename,
const char *path);
/**
* Create a "modify object" CMD. This command instructs
* the twister to modify the next object that is downloaded
* from the proxied service.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to modify.
* @param value value to put as the object's.
*
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_modify_object_dl (const char *label,
const char *config_filename,
const char *path,
const char *value);
/**
* Create a "modify object" CMD. This command instructs
* the twister to modify the next object that will be uploaded
* to the proxied service.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation pointing the object
* to modify.
* @param value value to put as the object's.
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_modify_object_ul (const char *label,
const char *config_filename,
const char *path,
const char *value);
/**
* Create a "malform response" CMD. This command makes
* the next response randomly malformed (by truncating it).
*
* @param label command label
* @param config_filename configuration filename.
*
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_malform_response (const char *label,
const char *config_filename);
/**
* Create a "malform request" CMD. This command makes the
* next request randomly malformed (by truncating it).
*
* @param label command label
* @param config_filename configuration filename.
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_malform_request (const char *label,
const char *config_filename);
/**
* Define a "flip object" command, for objects to upload.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to flip.
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_flip_upload (const char *label,
const char *config_filename,
const char *path);
/**
* Define a "flip object" command, for objects to download.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to flip.
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_flip_download (const char *label,
const char *config_filename,
const char *path);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,157 @@
/*
This file is part of TALER
Copyright (C) 2014-2018 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3, or
(at your option) any later version.
TALER is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
*/
/**
* @file twister/testing_api_helpers.c
* @brief helper functions for test library.
* @author Christian Grothoff
* @author Marcello Stanisci
*/
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include "taler_twister_testing_lib.h"
/**
* Prepare twister for execution; mainly checks whether the
* HTTP port is available and construct the base URL based on it.
*
* @param config_filename configuration file name.
* @return twister base URL, NULL upon errors.
*/
char *
TALER_TWISTER_prepare_twister (const char *config_filename)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
unsigned long long port;
char *base_url;
cfg = GNUNET_CONFIGURATION_create ();
if (GNUNET_OK != GNUNET_CONFIGURATION_load
(cfg, config_filename))
TWISTER_FAIL ();
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
(cfg, "twister",
"HTTP_PORT", &port))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"twister",
"HTTP_PORT");
GNUNET_CONFIGURATION_destroy (cfg);
TWISTER_FAIL ();
}
GNUNET_CONFIGURATION_destroy (cfg);
if (GNUNET_OK != GNUNET_NETWORK_test_port_free
(IPPROTO_TCP, (uint16_t) port))
{
fprintf (stderr,
"Required port %llu not available, skipping.\n",
port);
TWISTER_FAIL ();
}
GNUNET_assert (0 < GNUNET_asprintf
(&base_url,
"http://localhost:%llu/",
port));
return base_url;
}
/**
* Run the twister service.
*
* @param config_filename configuration file name.
* @return twister process handle, NULL upon errors.
*/
struct GNUNET_OS_Process *
TALER_TWISTER_run_twister (const char *config_filename)
{
struct GNUNET_OS_Process *proc;
struct GNUNET_OS_Process *client_proc;
unsigned long code;
enum GNUNET_OS_ProcessStatusType type;
proc = GNUNET_OS_start_process (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL,
NULL, NULL, NULL,
"taler-twister-service",
"taler-twister-service",
"-c", config_filename,
NULL);
if (NULL == proc)
TWISTER_FAIL ();
client_proc = GNUNET_OS_start_process (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL,
NULL, NULL, NULL,
"taler-twister",
"taler-twister",
"-c", config_filename,
"-a", NULL);
if (NULL == client_proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not start the taler-twister client\n");
GNUNET_OS_process_kill (proc, SIGTERM);
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);
TWISTER_FAIL ();
}
if (GNUNET_SYSERR == GNUNET_OS_process_wait_status
(client_proc, &type, &code))
{
GNUNET_OS_process_destroy (client_proc);
GNUNET_OS_process_kill (proc, SIGTERM);
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);
TWISTER_FAIL ();
}
if ( (type == GNUNET_OS_PROCESS_EXITED) &&
(0 != code) )
{
fprintf (stderr, "Failed to check twister works.\n");
GNUNET_OS_process_destroy (client_proc);
GNUNET_OS_process_kill (proc, SIGTERM);
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);
TWISTER_FAIL ();
}
if ( (type != GNUNET_OS_PROCESS_EXITED) ||
(0 != code) )
{
fprintf (stderr, "Unexpected error running"
" `taler-twister'!\n");
GNUNET_OS_process_destroy (client_proc);
GNUNET_OS_process_kill (proc, SIGTERM);
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);
TWISTER_FAIL ();
}
GNUNET_OS_process_destroy (client_proc);
return proc;
}