diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-10-08 13:58:37 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-10-14 17:05:49 +0000 |
commit | 6885d5f9ebd97e19d520280a2a85a4081e8ad060 (patch) | |
tree | 26d0345b66fdc3d6d0f4169a256c42ab6d86e928 /src | |
parent | 5c8ddd54c12e05db233173e890152ecda4c27888 (diff) |
hs-test: http_static wrk tests
Type: test
Change-Id: I87cddb88f2a62e79d66832827134ddaa95740839
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/hs_apps/test_builtins.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/plugins/hs_apps/test_builtins.c b/src/plugins/hs_apps/test_builtins.c index 631c1f1a8a2..c314e71b5df 100644 --- a/src/plugins/hs_apps/test_builtins.c +++ b/src/plugins/hs_apps/test_builtins.c @@ -16,6 +16,7 @@ typedef struct tb_main_ tw_timer_elt_t *delayed_resps; tw_timer_wheel_2t_1w_2048sl_t tw; hss_session_send_fn send_data; + u8 *test_data; } tb_main_t; static tb_main_t tb_main; @@ -51,7 +52,7 @@ VLIB_REGISTER_NODE (test_builtins_timer_process_node) = { }; static void -send_data_to_hss (hss_session_handle_t sh, u8 *data) +send_data_to_hss (hss_session_handle_t sh, u8 *data, u8 free_vec_data) { tb_main_t *tbm = &tb_main; hss_url_handler_args_t args = {}; @@ -61,7 +62,7 @@ send_data_to_hss (hss_session_handle_t sh, u8 *data) args.data_len = vec_len (data); args.ct = HTTP_CONTENT_TEXT_PLAIN; args.sc = HTTP_STATUS_OK; - args.free_vec_data = 1; + args.free_vec_data = free_vec_data; tbm->send_data (&args); } @@ -73,7 +74,7 @@ handle_get_test1 (hss_url_handler_args_t *args) clib_warning ("get request on test1"); data = format (0, "hello"); - send_data_to_hss (args->sh, data); + send_data_to_hss (args->sh, data, 1); return HSS_URL_HANDLER_ASYNC; } @@ -85,7 +86,7 @@ handle_get_test2 (hss_url_handler_args_t *args) clib_warning ("get request on test2"); data = format (0, "some data"); - send_data_to_hss (args->sh, data); + send_data_to_hss (args->sh, data, 1); return HSS_URL_HANDLER_ASYNC; } @@ -105,7 +106,7 @@ delayed_resp_cb (u32 *expired_timers) e = pool_elt_at_index (tbm->delayed_resps, pool_index); clib_warning ("sending delayed data"); data = format (0, "delayed data"); - send_data_to_hss (e->sh, data); + send_data_to_hss (e->sh, data, 1); pool_put (tbm->delayed_resps, e); } } @@ -128,7 +129,15 @@ handle_get_test_delayed (hss_url_handler_args_t *args) static hss_url_handler_rc_t handle_post_test3 (hss_url_handler_args_t *args) { - send_data_to_hss (args->sh, 0); + send_data_to_hss (args->sh, 0, 0); + return HSS_URL_HANDLER_ASYNC; +} + +static hss_url_handler_rc_t +handle_get_64bytes (hss_url_handler_args_t *args) +{ + tb_main_t *tbm = &tb_main; + send_data_to_hss (args->sh, tbm->test_data, 0); return HSS_URL_HANDLER_ASYNC; } @@ -148,10 +157,14 @@ test_builtins_init (vlib_main_t *vm) return; } + tbm->test_data = format ( + 0, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + (*fp) (handle_get_test1, "test1", HTTP_REQ_GET); (*fp) (handle_get_test2, "test2", HTTP_REQ_GET); (*fp) (handle_get_test_delayed, "test_delayed", HTTP_REQ_GET); (*fp) (handle_post_test3, "test3", HTTP_REQ_POST); + (*fp) (handle_get_64bytes, "64B", HTTP_REQ_GET); tbm->send_data = vlib_get_plugin_symbol ("http_static_plugin.so", "hss_session_send_data"); |