mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-30 08:03:49 +00:00
Fix a failing keyring test
The in-memory identity creation test was failing intermittently because the server only creates the in-memory identity on the first tick, and under load the server sometimes does not tick for a while, leading to a race with the "servald id self" command. The test case now waits for the server to emit a tick before running the "id self" command. This necessitated a new DEBUG() statement and a new debug flag 'overlaytick'. Also disabled Rhizome for all the keyring tests, as unnecessary Rhizome DB creation was slowing down the fixtures.
This commit is contained in:
parent
2cfdafdb56
commit
43bd0bd33f
@ -246,6 +246,7 @@ ATOM(bool_t, radio_link, 0, boolean,, "")
|
|||||||
ATOM(bool_t, overlaybuffer, 0, boolean,, "")
|
ATOM(bool_t, overlaybuffer, 0, boolean,, "")
|
||||||
ATOM(bool_t, overlayframes, 0, boolean,, "")
|
ATOM(bool_t, overlayframes, 0, boolean,, "")
|
||||||
ATOM(bool_t, packets_sent, 0, boolean,, "")
|
ATOM(bool_t, packets_sent, 0, boolean,, "")
|
||||||
|
ATOM(bool_t, overlaytick, 0, boolean,, "")
|
||||||
ATOM(bool_t, overlayrouting, 0, boolean,, "")
|
ATOM(bool_t, overlayrouting, 0, boolean,, "")
|
||||||
ATOM(bool_t, overlayinterfaces, 0, boolean,, "")
|
ATOM(bool_t, overlayinterfaces, 0, boolean,, "")
|
||||||
ATOM(bool_t, broadcasts, 0, boolean,, "")
|
ATOM(bool_t, broadcasts, 0, boolean,, "")
|
||||||
|
@ -586,6 +586,11 @@ int overlay_send_tick_packet(struct network_destination *destination)
|
|||||||
packet.seq);
|
packet.seq);
|
||||||
}
|
}
|
||||||
overlay_fill_send_packet(&packet, gettime_ms(), debug);
|
overlay_fill_send_packet(&packet, gettime_ms(), debug);
|
||||||
|
// This debug statement is used for testing; do not remove or alter.
|
||||||
|
DEBUGF(overlaytick, "TICK name=%s destination=%s seq=%d",
|
||||||
|
packet.destination->interface->name,
|
||||||
|
alloca_socket_address(&packet.destination->address),
|
||||||
|
packet.seq);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ setup_instances() {
|
|||||||
for arg; do
|
for arg; do
|
||||||
set_instance $arg
|
set_instance $arg
|
||||||
executeOk_servald config \
|
executeOk_servald config \
|
||||||
|
set rhizome.enable off \
|
||||||
set log.console.level debug \
|
set log.console.level debug \
|
||||||
set debug.keyring on
|
set debug.keyring on
|
||||||
executeOk_servald keyring list
|
executeOk_servald keyring list
|
||||||
@ -177,9 +178,11 @@ test_KeyringPinIdentityPin() {
|
|||||||
assert_keyring_list 0
|
assert_keyring_list 0
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_KeyringAutoCreate="Starting a server with no interfaces does not create an identity"
|
doc_KeyringAutoCreate="Server with no interfaces does not create an identity"
|
||||||
test_KeyringAutoCreate() {
|
test_KeyringAutoCreate() {
|
||||||
executeOk_servald config set debug.mdprequests on
|
executeOk_servald config \
|
||||||
|
set debug.mdprequests on \
|
||||||
|
set debug.overlaytick on
|
||||||
configure_servald_server() {
|
configure_servald_server() {
|
||||||
:
|
:
|
||||||
}
|
}
|
||||||
@ -196,13 +199,21 @@ teardown_KeyringAutoCreate() {
|
|||||||
teardown_servald
|
teardown_servald
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_KeyringNoAutoCreate="Starting a server with interface creates an in-memory identity"
|
has_sent_mdp_tick_to() {
|
||||||
|
$GREP "TICK name=$1 " $instance_servald_log || return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
doc_KeyringNoAutoCreate="Server creates an in-memory identity on the first interface tick"
|
||||||
test_KeyringNoAutoCreate() {
|
test_KeyringNoAutoCreate() {
|
||||||
executeOk_servald config set debug.mdprequests on
|
executeOk_servald config \
|
||||||
|
set debug.mdprequests on \
|
||||||
|
set debug.overlaytick on
|
||||||
configure_servald_server() {
|
configure_servald_server() {
|
||||||
add_servald_interface
|
add_servald_interface
|
||||||
}
|
}
|
||||||
start_servald_server
|
start_servald_server
|
||||||
|
wait_until has_sent_mdp_tick_to "dummy1/$instance_name"
|
||||||
executeOk_servald keyring list
|
executeOk_servald keyring list
|
||||||
assert_keyring_list 0
|
assert_keyring_list 0
|
||||||
executeOk_servald id self
|
executeOk_servald id self
|
||||||
|
Loading…
x
Reference in New Issue
Block a user