Skip to content

Commit

Permalink
test/http: decrease test runs from 20 to 3 to decrease test time
Browse files Browse the repository at this point in the history
Multiple HTTP requests are sent in parallel. Processing of the responses are done
asynchronously in the main thread. The test should ensure that there is no double
free, memleak, mix-up of content, ... for multiple parallel requests.
Fixes #1211 slow https test.
  • Loading branch information
fAuernigg committed Nov 21, 2024
1 parent 760f1d3 commit 70ff497
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions test/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
enum large_body_test {
REQ_BODY_CHUNK_SIZE = 26 * 42,
REQ_BODY_SIZE = REQ_BODY_CHUNK_SIZE * 480 - 26,
REQ_HTTP_REQUESTS = 2
REQ_HTTP_REQUESTS = 3
};

enum {
Expand Down Expand Up @@ -514,10 +514,20 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn,
dconf.cache_ttl_max = 1800;
dconf.getaddrinfo = dnsc_getaddrinfo_enabled(dnsc);

if (dns_set_conf_test) {
err = dnsc_conf_set(dnsc, &dconf);
if (err)
goto out;
}

err = http_client_alloc(&cli, dnsc);
if (err)
goto out;

err = http_client_set_config(cli, &hconf);
if (err)
goto out;

#ifdef USE_TLS
if (secure) {
struct tls* cli_tls;
Expand Down Expand Up @@ -590,23 +600,12 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn,
sa_port(&srv),
t.cert_auth ? "auth/" : "");

for (i = 1; i <= 10*REQ_HTTP_REQUESTS; i++) {
for (i = 1; i <= REQ_HTTP_REQUESTS; i++) {
t.i_req_body = 0;

err = http_client_set_config(cli, &hconf);
if (err)
goto out;

if (dns_set_conf_test) {
err = dnsc_conf_set(dnsc, &dconf);
if (err)
goto out;
}

t.clen = put ? REQ_BODY_SIZE :
2 * strlen("abcdefghijklmnopqrstuvwxyz");


if (http_conn) {
err = http_reqconn_alloc(&conn, cli,
http_resp_handler, http_data_handler, &t);
Expand Down

0 comments on commit 70ff497

Please sign in to comment.