Skip to content

Commit 5fadeb4

Browse files
committed
test/http: decrease test runs from 20 to 3 to decrease test time
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.
1 parent 760f1d3 commit 5fadeb4

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

test/http.c

+12-13
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
enum large_body_test {
1616
REQ_BODY_CHUNK_SIZE = 26 * 42,
1717
REQ_BODY_SIZE = REQ_BODY_CHUNK_SIZE * 480 - 26,
18-
REQ_HTTP_REQUESTS = 2
18+
REQ_HTTP_REQUESTS = 3
1919
};
2020

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

517+
if (dns_set_conf_test) {
518+
err = dnsc_conf_set(dnsc, &dconf);
519+
if (err)
520+
goto out;
521+
}
522+
517523
err = http_client_alloc(&cli, dnsc);
518524
if (err)
519525
goto out;
520526

527+
err = http_client_set_config(cli, &hconf);
528+
if (err)
529+
goto out;
530+
521531
#ifdef USE_TLS
522532
if (secure) {
523533
struct tls* cli_tls;
@@ -590,23 +600,12 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn,
590600
sa_port(&srv),
591601
t.cert_auth ? "auth/" : "");
592602

593-
for (i = 1; i <= 10*REQ_HTTP_REQUESTS; i++) {
603+
for (i = 1; i <= REQ_HTTP_REQUESTS; i++) {
594604
t.i_req_body = 0;
595605

596-
err = http_client_set_config(cli, &hconf);
597-
if (err)
598-
goto out;
599-
600-
if (dns_set_conf_test) {
601-
err = dnsc_conf_set(dnsc, &dconf);
602-
if (err)
603-
goto out;
604-
}
605-
606606
t.clen = put ? REQ_BODY_SIZE :
607607
2 * strlen("abcdefghijklmnopqrstuvwxyz");
608608

609-
610609
if (http_conn) {
611610
err = http_reqconn_alloc(&conn, cli,
612611
http_resp_handler, http_data_handler, &t);

0 commit comments

Comments
 (0)