[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [sbws/master] fix: test: Add chutney configuration
commit 212047f4c4601d263078cde4338060704d026d78
Author: juga0 <juga@xxxxxxxxxx>
Date: Thu Dec 17 15:30:11 2020 +0000
fix: test: Add chutney configuration
and scripts to run the integration tests with chutney.
It does not replace yet the way integration tests are run.
---
.gitignore | 1 +
tests/integration/chutney_data/bwscanner | 15 +++++++++++++
.../integration/chutney_data/client_bwscanner.tmpl | 23 +++++++++++++++++++
tests/integration/chutney_data/non-exit.tmpl | 4 ++++
tests/integration/chutney_data/relay-MAB.tmpl | 4 ++++
tests/integration/chutney_data/relay-MBR.tmpl | 4 ++++
tests/integration/run.sh | 14 ++++++++++++
tests/integration/start_chutney.sh | 26 ++++++++++++++++++++++
tests/integration/stop_chutney.sh | 10 +++++++++
9 files changed, 101 insertions(+)
diff --git a/.gitignore b/.gitignore
index 9903d5d..744436b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ htmlcov
dist
build
*.lockfile
+chutney
diff --git a/tests/integration/chutney_data/bwscanner b/tests/integration/chutney_data/bwscanner
new file mode 100644
index 0000000..6506bc3
--- /dev/null
+++ b/tests/integration/chutney_data/bwscanner
@@ -0,0 +1,15 @@
+# By default, Authorities are not configured as exits
+Authority = Node(tag="a", authority=1, relay=1, torrc="authority.tmpl")
+NonExitRelay = Node(tag="m", relay=1, exit=0, torrc="non-exit.tmpl")
+ExitRelay = Node(tag="r", relay=1, exit=1, torrc="relay.tmpl")
+Client = Node(tag="c", client=1, torrc="client_bwscanner.tmpl")
+RelayMAB = Node(tag="relay1mbyteMAB", relay=1, torrc="relay-MAB.tmpl")
+RelayMBR = Node(tag="relay1mbyteMBR", relay=1, torrc="relay-MBR.tmpl")
+
+NODES = Authority.getN(3) + \
+ NonExitRelay.getN(9) + \
+ ExitRelay.getN(3) + Client.getN(1)
+
+# RelayMBR.getN(1) + RelayMAB.getN(1) + \
+
+ConfigureNodes(NODES)
diff --git a/tests/integration/chutney_data/client_bwscanner.tmpl b/tests/integration/chutney_data/client_bwscanner.tmpl
new file mode 100644
index 0000000..dc6d0d8
--- /dev/null
+++ b/tests/integration/chutney_data/client_bwscanner.tmpl
@@ -0,0 +1,23 @@
+${include:common.i}
+SocksPort $socksport
+
+#NOTE: Setting TestingClientConsensusDownloadSchedule doesn't
+# help -- dl_stats.schedule is not DL_SCHED_CONSENSUS
+# at boostrap time.
+# Try to download after:
+# the minimum initial consensus time to start with,
+# a few eager fetches,
+# then half the minimum testing consensus interval
+#TestingClientDownloadSchedule 0, 5
+#TestingClientConsensusDownloadSchedule 0, 5
+#ControlPort 8015
+UseEntryGuards 0
+UseMicroDescriptors 0
+FetchDirInfoEarly 1
+FetchDirInfoExtraEarly 1
+FetchUselessDescriptors 1
+LearnCircuitBuildTimeout 0
+CircuitBuildTimeout 60
+ConnectionPadding 0
+__DisablePredictedCircuits 1
+__LeaveStreamsUnattached 1
diff --git a/tests/integration/chutney_data/non-exit.tmpl b/tests/integration/chutney_data/non-exit.tmpl
new file mode 100644
index 0000000..25d8806
--- /dev/null
+++ b/tests/integration/chutney_data/non-exit.tmpl
@@ -0,0 +1,4 @@
+${include:relay-non-exit.tmpl}
+
+ExitRelay 0
+ExitPolicy reject *:*
diff --git a/tests/integration/chutney_data/relay-MAB.tmpl b/tests/integration/chutney_data/relay-MAB.tmpl
new file mode 100644
index 0000000..28bc6a7
--- /dev/null
+++ b/tests/integration/chutney_data/relay-MAB.tmpl
@@ -0,0 +1,4 @@
+${include:non-exit.tmpl}
+
+Nickname relay1mbyteMAB
+MaxAdvertisedBandwidth 1 MBytes
diff --git a/tests/integration/chutney_data/relay-MBR.tmpl b/tests/integration/chutney_data/relay-MBR.tmpl
new file mode 100644
index 0000000..946600b
--- /dev/null
+++ b/tests/integration/chutney_data/relay-MBR.tmpl
@@ -0,0 +1,4 @@
+${include:non-exit.tmpl}
+
+Nickname relay1mbyteMBR
+RelayBandwidthRate 1 MBytes
diff --git a/tests/integration/run.sh b/tests/integration/run.sh
new file mode 100755
index 0000000..e870b50
--- /dev/null
+++ b/tests/integration/run.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -x
+
+tests/integration/start_chutney.sh
+python3 scripts/tools/sbws-http-server.py --port 28888 &>/dev/null &
+sleep 1
+wget -O/dev/null http://127.0.0.1:28888/sbws.bin
+# Run actually the scanner
+sbws -c tests/integration/sbws_testnet.ini scanner
+sbws -c tests/integration/sbws_testnet.ini generate
+# Run integration tests
+coverage run -a --rcfile=.coveragerc --source=sbws -m pytest -s tests/integration -vv
+sbws -c tests/integration/sbws_testnet.ini cleanup
+tests/integration/stop_chutney.sh
diff --git a/tests/integration/start_chutney.sh b/tests/integration/start_chutney.sh
new file mode 100755
index 0000000..04f9641
--- /dev/null
+++ b/tests/integration/start_chutney.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+set -x
+
+CURRENT_DIR=`pwd`
+CHUTNEY_DIR=${1:-./chutney}
+
+# If chutney dir already exists, this will fail but it doesn't matter.
+git clone https://git.torproject.org/chutney.git $CHUTNEY_DIR
+
+cp tests/integration/chutney_data/bwscanner $CHUTNEY_DIR/networks
+cp tests/integration/chutney_data/*.tmpl $CHUTNEY_DIR/torrc_templates
+
+cd $CHUTNEY_DIR
+# In case it wasn't cloned recently, pull.
+# Since this is run only for the tests, it's ok if the tests fail with a newer
+# chutney version, so that we can detect it early.
+git pull
+
+# Stop chutney network if it is already running
+./chutney stop networks/bwscanner
+./chutney configure networks/bwscanner
+./chutney start networks/bwscanner
+./chutney status networks/bwscanner
+./chutney wait_for_bootstrap networks/bwscanner
+
+cd $CURRENT_DIR
diff --git a/tests/integration/stop_chutney.sh b/tests/integration/stop_chutney.sh
new file mode 100755
index 0000000..6008453
--- /dev/null
+++ b/tests/integration/stop_chutney.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+set -x
+
+CURRENT_DIR=`pwd`
+CHUTNEY_DIR=${1:-./chutney}
+cd $CHUTNEY_DIR
+# Stop chutney network if it is already running
+./chutney stop networks/bwscanner
+cd $CURRENT_DIR
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits