twister

HTTP fault injector for testing
Log | Files | Refs | README | LICENSE

commit 540ac8ac81319f3f57300a28872f2f67b32267c5
parent 63c64f0bd49165cebc77a15aafb836e396ac789a
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Thu,  8 Mar 2018 17:18:08 +0100

renaming operation.

Diffstat:
Msrc/include/taler_twister_testing_lib.h | 12++++++------
Msrc/test/test_twister.sh | 4++--
Msrc/twister/taler-twister.c | 7+++----
Msrc/twister/testing_api_cmd_exec_client.c | 75+++++++++++++++++++++++++++++++++++++--------------------------------------
4 files changed, 48 insertions(+), 50 deletions(-)

diff --git a/src/include/taler_twister_testing_lib.h b/src/include/taler_twister_testing_lib.h @@ -48,20 +48,20 @@ TALER_TESTING_cmd_hack_response_code (const char *label, /** - * This command replaces the JSON object contained in the - * response and pointed by @a path, with a empty one ("{}"). + * This command deletes the JSON object contained in the + * response and pointed by @a path. * * @param label command label * @param config_filename configuration filename. * @param path object-like path notation to point the object * to be made empty. "f1.0.f2" will empty the object - * {"f1": [{"f2": {will be emptied. }}]}. + * {"f1": [{"f2": "I'll be deleted"}]}. * * @return the command */ struct TALER_TESTING_Command -TALER_TESTING_cmd_empty_object (const char *label, - const char *config_filename, - const char *path); +TALER_TESTING_cmd_delete_object (const char *label, + const char *config_filename, + const char *path); #endif diff --git a/src/test/test_twister.sh b/src/test/test_twister.sh @@ -16,8 +16,8 @@ taler-twister -c ./test_twister.conf --responsecode 202 status_code=$(curl -s ${TWISTER_URL} -o /dev/null \ -w "%{http_code}") -# empty (inner) object. -taler-twister -c ./test_twister.conf -e "hello.0" +# delete object. +taler-twister -c ./test_twister.conf -d "hello.0" # get emptied response. emptied_body=$(curl -s ${TWISTER_URL}) diff --git a/src/twister/taler-twister.c b/src/twister/taler-twister.c @@ -170,12 +170,11 @@ main (int argc, struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_option_string - ('e', - "emptyobject", + ('d', + "deleteobject", "PATH", gettext_noop - ("Make the object pointed by PATH empty." - " It will not empty non-objects.\n"), + ("Delete the object pointed by PATH.\n"), &delete_path), GNUNET_GETOPT_option_flag diff --git a/src/twister/testing_api_cmd_exec_client.c b/src/twister/testing_api_cmd_exec_client.c @@ -29,7 +29,7 @@ #include <taler/taler_testing_lib.h> #include "taler_twister_testing_lib.h" -struct EmptyObjectState +struct DeleteObjectState { /** * Process handle for the twister CLI client. @@ -37,7 +37,7 @@ struct EmptyObjectState struct GNUNET_OS_Process *proc; /** - * Object-like notation to the object to make empty. + * Object-like notation to the object to delete. */ const char *path; @@ -191,21 +191,21 @@ TALER_TESTING_cmd_hack_response_code (const char *label, * @param cls closure */ static void -empty_object_cleanup +delete_object_cleanup (void *cls, const struct TALER_TESTING_Command *cmd) { - struct EmptyObjectState *eos = cls; + struct DeleteObjectState *dos = cls; - if (NULL != eos->proc) + if (NULL != dos->proc) { - GNUNET_break (0 == GNUNET_OS_process_kill (eos->proc, + GNUNET_break (0 == GNUNET_OS_process_kill (dos->proc, SIGKILL)); - GNUNET_OS_process_wait (eos->proc); - GNUNET_OS_process_destroy (eos->proc); - eos->proc = NULL; + GNUNET_OS_process_wait (dos->proc); + GNUNET_OS_process_destroy (dos->proc); + dos->proc = NULL; } - GNUNET_free (eos); + GNUNET_free (dos); } /** @@ -221,15 +221,15 @@ empty_object_cleanup * @return #GNUNET_OK on success */ static int -empty_object_traits (void *cls, - void **ret, - const char *trait, - unsigned int index) +delete_object_traits (void *cls, + void **ret, + const char *trait, + unsigned int index) { - struct EmptyObjectState *eos = cls; + struct DeleteObjectState *dos = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_process (0, &eos->proc), + TALER_TESTING_make_trait_process (0, &dos->proc), TALER_TESTING_trait_end () }; @@ -244,21 +244,21 @@ empty_object_traits (void *cls, * FIXME: document. */ static void -empty_object_run (void *cls, - const struct TALER_TESTING_Command *cmd, - struct TALER_TESTING_Interpreter *is) +delete_object_run (void *cls, + const struct TALER_TESTING_Command *cmd, + struct TALER_TESTING_Interpreter *is) { - struct EmptyObjectState *eos = cls; + struct DeleteObjectState *dos = cls; - eos->proc = GNUNET_OS_start_process (GNUNET_NO, + dos->proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, "taler-twister", "taler-twister", - "-c", eos->config_filename, - "--emptyobject", eos->path, + "-c", dos->config_filename, + "--emptyobject", dos->path, NULL); - if (NULL == eos->proc) + if (NULL == dos->proc) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -269,33 +269,32 @@ empty_object_run (void *cls, /** - * This command replaces the JSON object contained in the - * response and pointed by @a path, with a empty one ("{}"). + * 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 be made empty. + * to delete. * * @return the command */ struct TALER_TESTING_Command -TALER_TESTING_cmd_empty_object (const char *label, - const char *config_filename, - const char *path) +TALER_TESTING_cmd_delete_object (const char *label, + const char *config_filename, + const char *path) { - struct EmptyObjectState *eos; + struct DeleteObjectState *dos; struct TALER_TESTING_Command cmd; - eos = GNUNET_new (struct EmptyObjectState); - eos->path = path; - eos->config_filename = config_filename; + dos = GNUNET_new (struct DeleteObjectState); + dos->path = path; + dos->config_filename = config_filename; cmd.label = label; - cmd.run = &empty_object_run; - cmd.cleanup = &empty_object_cleanup; - cmd.traits = &empty_object_traits; - cmd.cls = eos; + cmd.run = &delete_object_run; + cmd.cleanup = &delete_object_cleanup; + cmd.traits = &delete_object_traits; + cmd.cls = dos; return cmd; }