mirror of https://github.com/getdnsapi/getdns.git
Split the recursive transport test 6 into 3 and add a shorter timeout to the fail case to stop the overall test timing out.
This commit is contained in:
parent
b56fbbb604
commit
3ee5cf32b6
|
@ -203,10 +203,6 @@
|
|||
* Request answer larger then 512 bytes but set UDP payload to that
|
||||
* Call getdns_context_set_dns_transport() with value = GETDNS_TRANSPORT_UDP_ONLY
|
||||
* expect: No response returned
|
||||
* Call getdns_context_set_dns_transport() with value = GETDNS_TRANSPORT_TCP_ONLY
|
||||
* expect: Response returned
|
||||
* Call getdns_context_set_dns_transport() with value = GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP
|
||||
* expect: Response returned
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_dict *response = NULL;
|
||||
|
@ -230,7 +226,8 @@
|
|||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()");
|
||||
ASSERT_RC(getdns_context_set_edns_maximum_udp_payload_size(context, 512),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_edns_maximum_udp_payload_size()");
|
||||
|
||||
ASSERT_RC(getdns_context_set_timeout(context, 2000),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_edns_maximum_udp_payload_size()");
|
||||
ASSERT_RC(getdns_general_sync(context, "getdnsapi.net", 48, extensions, &response),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
|
||||
|
||||
|
@ -239,9 +236,32 @@
|
|||
|
||||
/* TODO: INVESTIGATE THIS AS IT SHOULDN'T BE A TIMEOUT...*/
|
||||
ASSERT_RC(status, GETDNS_RESPSTATUS_ALL_TIMEOUT, "Status not as expected");
|
||||
}
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_dns_transport_recursing_7)
|
||||
{
|
||||
/*
|
||||
* Call getdns_context_set_dns_transport() with value = GETDNS_TRANSPORT_TCP_ONLY
|
||||
* expect: Response returned
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_dict *response = NULL;
|
||||
struct getdns_dict *extensions = getdns_dict_create();
|
||||
uint32_t status;
|
||||
uint32_t mode;
|
||||
uint32_t tc;
|
||||
|
||||
CONTEXT_CREATE(TRUE);
|
||||
/* Need to explicit check as we may be compiled stub-only*/
|
||||
getdns_resolution_t resolution_type;
|
||||
ASSERT_RC(getdns_context_get_resolution_type(context, &resolution_type),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_get_resolution_type()");
|
||||
if (resolution_type == GETDNS_RESOLUTION_RECURSING) {
|
||||
|
||||
/* Re-do over TCP */
|
||||
ASSERT_RC(getdns_dict_set_int(extensions,"return_call_reporting", GETDNS_EXTENSION_TRUE),
|
||||
|
@ -259,9 +279,32 @@
|
|||
ASSERT_RC(getdns_dict_get_int(response, "/replies_tree/0/header/tc", &tc),
|
||||
GETDNS_RETURN_GOOD, "Failed to extract \"tc\"");
|
||||
ASSERT_RC(tc, 0, "Packet trucated - not as expected");
|
||||
}
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
CONTEXT_CREATE(TRUE);
|
||||
CONTEXT_DESTROY;
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (getdns_context_set_dns_transport_recursing_8)
|
||||
{
|
||||
/*
|
||||
* Call getdns_context_set_dns_transport() with value = GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP
|
||||
* expect: Response returned
|
||||
*/
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_dict *response = NULL;
|
||||
struct getdns_dict *extensions = getdns_dict_create();
|
||||
uint32_t status;
|
||||
uint32_t mode;
|
||||
uint32_t tc;
|
||||
|
||||
CONTEXT_CREATE(TRUE);
|
||||
/* Need to explicit check as we may be compiled stub-only*/
|
||||
getdns_resolution_t resolution_type;
|
||||
ASSERT_RC(getdns_context_get_resolution_type(context, &resolution_type),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_context_get_resolution_type()");
|
||||
if (resolution_type == GETDNS_RESOLUTION_RECURSING) {
|
||||
|
||||
/* Now let it fall back to TCP */
|
||||
ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP),
|
||||
|
@ -282,6 +325,7 @@
|
|||
END_TEST
|
||||
|
||||
|
||||
|
||||
Suite *
|
||||
getdns_context_set_dns_transport_suite (void)
|
||||
{
|
||||
|
@ -301,6 +345,8 @@
|
|||
/* TODO: Test which specific lists are supported */
|
||||
tcase_add_test(tc_pos, getdns_context_set_dns_transport_stub_5);
|
||||
tcase_add_test(tc_pos, getdns_context_set_dns_transport_recursing_6);
|
||||
tcase_add_test(tc_pos, getdns_context_set_dns_transport_recursing_7);
|
||||
tcase_add_test(tc_pos, getdns_context_set_dns_transport_recursing_8);
|
||||
/* TODO: TLS... */
|
||||
|
||||
suite_add_tcase(s, tc_pos);
|
||||
|
|
Loading…
Reference in New Issue