From 59a9c90813d35a27724172a6cbce1474428884a7 Mon Sep 17 00:00:00 2001 From: Mike Goelzer Date: Fri, 14 Sep 2018 12:26:17 -0700 Subject: [PATCH] Script for quick terminator 4x4 test --- .gitignore | 1 + README.md | 13 +++--- pubsub/test/terminator/config | 74 +++++++++++++++++++++++++++++++++++ pubsub/test/test.sh | 8 ++++ 4 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 pubsub/test/terminator/config create mode 100755 pubsub/test/test.sh diff --git a/.gitignore b/.gitignore index 3f71f9d..8a1da08 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ pubsub-interop content-dht-provide-find/js-dht-test/node_modules/ util/private-key-gen pubsub/js/node_modules +ibus diff --git a/README.md b/README.md index d7bd3a0..1cadbd1 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Running the Node.js program: ``` cd content-dht-provide-find/js-dht-test npm install # first time only -node js-dht-test/index.js /ip4/127.0.0.1/tcp/9876/ipfs/QmehVYruznbyDZuHBV4vEHESpDevMoAovET6aJ9oRuEzWa +node js-dht-test/index.js /ip4/127.0.0.1/tcp/5555/ipfs/QmehVYruznbyDZuHBV4vEHESpDevMoAovET6aJ9oRuEzWa ``` @@ -34,6 +34,8 @@ node js-dht-test/index.js /ip4/127.0.0.1/tcp/9876/ipfs/QmehVYruznbyDZuHBV4vEHESp **What it demonstrates**: Two Go peers, one JS peer, and one Rust peer are all created and run a chat server using a shared PubSub topic. Typing text in any peer sends it to all the other peers. +**Quick test**: `cd pubsub` and then run `./test/test.sh`. Requires Terminator (eg, `sudo apt-get install terminator`). The rest of this section describes how to test manually. + (**TODO**: eliminate centralized bootstrapper; any peer should be able to bootstrap from any other peer and peers should be able to start in any order) **First terminal**: Create the bootstrapper node @@ -58,7 +60,7 @@ This peer, which is not in bootstrapper mode, creates a node, subscribes to the ``` cd pubsub/js npm install # first time only -node index.js /ip4/127.0.0.1/tcp/9876/ipfs/QmehVYruznbyDZuHBV4vEHESpDevMoAovET6aJ9oRuEzWa +node index.js /ip4/127.0.0.1/tcp/5555/ipfs/QmehVYruznbyDZuHBV4vEHESpDevMoAovET6aJ9oRuEzWa ``` This JS peer will fire off a hello message every few seconds, which the other two subscribing nodes can see. @@ -67,13 +69,10 @@ This JS peer will fire off a hello message every few seconds, which the other tw ``` cd pubsub/rust -cargo run /ip4/0.0.0.0/tcp/9879 -# Wait for it to start up -/dial /ip4/127.0.0.1/tcp/9876 -# Now type any message to publish +cargo run ``` -The Rust peer listens on the CLI-specified port (9879 in the above example), and then the `/dial` command causes it to dial out to the boostrap host. (TODO: rust-libp2p#471) It is now subscribed to the same topic as the other peers. +The Rust peer starts up, listens on port 6002, and then dials the boostrap peer. (TODO: rust-libp2p#471) It is now subscribed to the same topic as the other peers. If you return to the second, third or fourth terminals and type a message, the bootstrapper and the other 2 peers will all print your message. diff --git a/pubsub/test/terminator/config b/pubsub/test/terminator/config new file mode 100644 index 0000000..ab42fc4 --- /dev/null +++ b/pubsub/test/terminator/config @@ -0,0 +1,74 @@ +[global_config] + suppress_multiple_term_dialog = True +[keybindings] +[layouts] + [[default]] + [[[child1]]] + command = "" + parent = window0 + type = Terminal + [[[window0]]] + parent = "" + type = Window + [[FourByFour]] + [[[child0]]] + fullscreen = False + last_active_term = e05bb5f2-7bce-41c4-a19b-26be884919df + last_active_window = True + maximised = True + order = 0 + parent = "" + position = 71:55 + size = 734, 451 + title = PubSub Demo (Go, JS, Rust) + type = Window + [[[child1]]] + order = 0 + parent = child0 + position = 223 + ratio = 0.5 + type = VPaned + [[[child2]]] + order = 0 + parent = child1 + position = 365 + ratio = 0.500685871056 + type = HPaned + [[[child5]]] + order = 1 + parent = child1 + position = 365 + ratio = 0.500685871056 + type = HPaned + [[[terminal3]]] + profile = default + command = 'pushd .. ; ./pubsub-interop -b ../util/private_key.bin.bootstrapper.Wa; popd ; bash' + order = 0 + parent = child2 + type = Terminal + uuid = e05bb5f2-7bce-41c4-a19b-26be884919df + [[[terminal4]]] + profile = default + command = 'sleep 1 ; pushd .. ; ./pubsub-interop ../util/private_key.bin.peer.Sk; popd ; bash' + order = 1 + parent = child2 + type = Terminal + uuid = a551b167-2da7-4994-ac12-5063852055da + [[[terminal6]]] + profile = default + command = 'sleep 1 ; pushd ../js ; node index.js /ip4/127.0.0.1/tcp/5555/ipfs/QmehVYruznbyDZuHBV4vEHESpDevMoAovET6aJ9oRuEzWa; popd ; bash' + order = 0 + parent = child5 + type = Terminal + uuid = 8358280f-49da-4a74-bb27-7a3c7e472fe9 + [[[terminal7]]] + profile = default + command = 'sleep 1 ; pushd ../rust ; cargo run; popd ; bash' + order = 1 + parent = child5 + type = Terminal + uuid = 2e086797-fccb-4548-8410-9267c1a4ead8 +[plugins] +[profiles] + [[default]] + cursor_color = "#aaaaaa" diff --git a/pubsub/test/test.sh b/pubsub/test/test.sh new file mode 100755 index 0000000..6560d30 --- /dev/null +++ b/pubsub/test/test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +SELF="$(pwd)/$0" +DIR=`dirname $SELF` + +pushd $DIR +XDG_CONFIG_HOME=. terminator --layout=FourByFour +popd