add test for falling over to MDP when HTTP rhizome fetching fails.

This commit is contained in:
gardners 2013-08-25 16:37:44 +09:30
parent a03c70bb86
commit 9b09021605
3 changed files with 24 additions and 1 deletions

View File

@ -258,6 +258,7 @@ ATOM(bool_t, rhizome, 0, boolean,, "")
ATOM(bool_t, rhizome_tx, 0, boolean,, "")
ATOM(bool_t, rhizome_rx, 0, boolean,, "")
ATOM(bool_t, rhizome_ads, 0, boolean,, "")
ATOM(bool_t, rhizome_nohttptx, 0, boolean,, "")
ATOM(bool_t, meshms, 0, boolean,, "")
ATOM(bool_t, manifests, 0, boolean,, "")
ATOM(bool_t, vomp, 0, boolean,, "")

View File

@ -620,7 +620,12 @@ int rhizome_server_parse_http_request(rhizome_http_request *r)
} else {
str_toupper_inplace(id);
bzero(&r->read_state, sizeof(r->read_state));
if (rhizome_open_read(&r->read_state, id))
/* Refuse to honour HTTP request if required (used for debugging and
testing transition from HTTP to MDP) */
if (config.debug.rhizome_nohttptx) {
rhizome_server_simple_http_response(r, 404, "<html><h1>Feigning 404 because debug.rhozome_nohttptx is set.</h1></html>\r\n");
} else if (rhizome_open_read(&r->read_state, id))
rhizome_server_simple_http_response(r, 404, "<html><h1>Payload not found</h1></html>\r\n");
else{
if (r->read_state.length==-1){

View File

@ -182,6 +182,23 @@ test_MDPTransport() {
receive_and_update_bundle
}
doc_MDPTransportFailOver="Rhizome fails over to MDP transport"
setup_MDPTransportFailOver() {
setup_common
foreach_instance +A +B \
executeOk_servald config \
set debug.rhizome_nohttptx 1 \
set rhizome.mdp.enable 1
set_instance +A
rhizome_add_file file1 2048
start_servald_instances +A +B
foreach_instance +A assert_peers_are_instances +B
foreach_instance +B assert_peers_are_instances +A
}
test_MDPTransportFailOver() {
receive_and_update_bundle
}
doc_UnicastTransfer="Rhizome over unicast MDP link"
setup_UnicastTransfer() {
setup_common