From 0f83b9a5fca191f596be79c0b25698bf1cd5be02 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Tue, 2 Apr 2013 14:54:46 +1030 Subject: [PATCH] Fix #60 - "rhizome direct" command line URL Add test case for "rhizome push " command --- commandline.c | 6 +++--- tests/rhizomeprotocol | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/commandline.c b/commandline.c index 7d437328..374dd114 100644 --- a/commandline.c +++ b/commandline.c @@ -2429,11 +2429,11 @@ struct cli_schema command_line_options[]={ {app_rhizome_delete,{"rhizome","delete","\\file", "",NULL},CLIFLAG_STANDALONE, "Remove the file with the given hash from the Rhizome store"}, - {app_rhizome_direct_sync,{"rhizome","direct","sync","[peer url]",NULL}, CLIFLAG_STANDALONE, + {app_rhizome_direct_sync,{"rhizome","direct","sync","[]",NULL}, CLIFLAG_STANDALONE, "Synchronise with the specified Rhizome Direct server. Return when done."}, - {app_rhizome_direct_sync,{"rhizome","direct","push","[peer url]",NULL}, CLIFLAG_STANDALONE, + {app_rhizome_direct_sync,{"rhizome","direct","push","[]",NULL}, CLIFLAG_STANDALONE, "Deliver all new content to the specified Rhizome Direct server. Return when done."}, - {app_rhizome_direct_sync,{"rhizome","direct","pull","[peer url]",NULL}, CLIFLAG_STANDALONE, + {app_rhizome_direct_sync,{"rhizome","direct","pull","[]",NULL}, CLIFLAG_STANDALONE, "Fetch all new content from the specified Rhizome Direct server. Return when done."}, {app_rhizome_clean,{"rhizome","clean",NULL},CLIFLAG_STANDALONE, "Remove stale and orphaned content from the Rhizome store"}, diff --git a/tests/rhizomeprotocol b/tests/rhizomeprotocol index b6669969..89834841 100755 --- a/tests/rhizomeprotocol +++ b/tests/rhizomeprotocol @@ -37,8 +37,6 @@ teardown() { # Called by start_servald_instances for each instance. configure_servald_server() { executeOk_servald config \ - set log.show_pid on \ - set log.show_time on \ set debug.rhizome on \ set debug.rhizome_tx on \ set debug.rhizome_rx on \ @@ -450,11 +448,9 @@ setup_direct() { get_rhizome_server_port PORTA +A set_instance +B executeOk_servald config \ - set log.show_time on \ set debug.rhizome on \ set debug.rhizome_tx on \ - set debug.rhizome_rx on \ - set rhizome.direct.peer.0 "http://${addr_localhost}:${PORTA}" + set debug.rhizome_rx on rhizome_add_file fileB1 2000 BID_B1=$BID VERSION_B1=$VERSION @@ -466,10 +462,16 @@ setup_direct() { VERSION_B3=$VERSION } -doc_DirectPush="One way push bundles to unconnected node" +setup_direct_peer() { + executeOk_servald config \ + set rhizome.direct.peer.0 "http://${addr_localhost}:${PORTA}" +} + +doc_DirectPush="One way direct push bundles to configured peer" setup_DirectPush() { setup_common setup_direct + setup_direct_peer } test_DirectPush() { set_instance +B @@ -487,10 +489,32 @@ test_DirectPush() { assert_rhizome_list --fromhere=1 fileB1 fileB2 fileB3 } -doc_DirectPull="One way pull bundle from unconnected node" +doc_DirectPushArg="One way direct push bundles to given peer URL" +setup_DirectPushArg() { + setup_common + setup_direct +} +test_DirectPushArg() { + set_instance +B + executeOk_servald rhizome direct push "http://${addr_localhost}:${PORTA}" + tfw_cat --stdout --stderr + assert bundle_received_by $BID_B1:$VERSION_B1 $BID_B2:$VERSION_B2 $BID_B3:$VERSION_B3 +A + set_instance +A + executeOk_servald rhizome list + assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3 --fromhere=0 fileB1 fileB2 fileB3 + assert_rhizome_received fileB1 + assert_rhizome_received fileB2 + assert_rhizome_received fileB3 + set_instance +B + executeOk_servald rhizome list + assert_rhizome_list --fromhere=1 fileB1 fileB2 fileB3 +} + +doc_DirectPull="One way direct pull bundle from configured peer" setup_DirectPull() { setup_common setup_direct + setup_direct_peer } test_DirectPull() { set_instance +B @@ -508,10 +532,11 @@ test_DirectPull() { assert_rhizome_received fileA3 } -doc_DirectSync="Two-way sync bundles between unconnected nodes" +doc_DirectSync="Two-way direct sync bundles with configured peer" setup_DirectSync() { setup_common setup_direct + setup_direct_peer } test_DirectSync() { set_instance +B