[tor-commits] [sbws/master] Add more data and more realistic to the tests

juga at torproject.org juga at torproject.org
Tue Sep 18 09:26:11 UTC 2018


commit 2e4e08582327df45ceced99d4d5c0748689ede17
Author: juga0 <juga at riseup.net>
Date:   Wed Aug 29 20:10:01 2018 +0000

    Add more data and more realistic to the tests
---
 tests/unit/conftest.py | 53 ++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 8 deletions(-)

diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py
index 3ebee46..0564a50 100644
--- a/tests/unit/conftest.py
+++ b/tests/unit/conftest.py
@@ -22,19 +22,56 @@ NICK1 = 'A'
 NICK2 = 'B'
 IP1 = '169.254.100.1'
 IP2 = '169.254.100.2'
-RTTS = [5, 25]
-DOWNLOADS = [{'duration': 4, 'amount': 40}]
+RTTS1 = [
+    0.2943556308746338, 0.2885427474975586, 0.2802879810333252,
+    0.28124427795410156, 0.2827129364013672, 0.2901294231414795,
+    0.2784590721130371, 0.2838578224182129, 0.2842121124267578,
+    0.28656768798828125
+]
+RTTS2 = [
+    0.9097037315368652, 0.9293286800384521, 2.3764255046844482,
+    0.869133710861206, 0.8188621997833252, 0.9046516418457031,
+    1.3477752208709717, 0.8118226528167725, 0.8821918964385986,
+    0.8746812343597412
+]
+RTTS3 = [
+    0.510988712310791, 0.4889242649078369, 0.5003941059112549,
+    0.49333715438842773, 0.5000274181365967, 0.5426476001739502,
+    0.5190870761871338, 0.4908745288848877, 0.5516133308410645,
+    0.4995298385620117
+]
+DOWNLOADS1 = [
+    {"duration": 28.01000952720642, "amount": 25916542},
+    {"duration": 28.203476428985596, "amount": 25916542},
+    {"duration": 27.897520780563354, "amount": 25916542},
+    {"duration": 29.330559492111206, "amount": 25916542},
+    {"duration": 27.93175745010376, "amount": 25916542}
+]
+DOWNLOADS2 = [
+    {"duration": 23.68175435066223, "amount": 81920},
+    {"duration": 27.667736768722534, "amount": 81920},
+    {"duration": 31.022956371307373, "amount": 81920},
+    {"duration": 33.020694971084595, "amount": 81920},
+    {"duration": 33.59471535682678, "amount": 81920}
+]
+DOWNLOADS3 = [
+    {"duration": 30.008347988128662, "amount": 644411},
+    {"duration": 30.73241639137268, "amount": 644411},
+    {"duration": 31.845987796783447, "amount": 644411},
+    {"duration": 29.703084230422974, "amount": 644411},
+    {"duration": 30.438726663589478, "amount": 644411}
+]
 SCANNER = "test"
-AVG_BW = 1024 * 1024
+AVG_BW = 966080
 
 RELAY1 = Result.Relay(FP1, NICK1, IP1, ED25519,
                       average_bandwidth=AVG_BW)
-RELAY2 = Result.Relay(FP1, NICK2, IP2, ED25519)
+RELAY2 = Result.Relay(FP2, NICK2, IP2, ED25519)
 
 RESULT = Result(RELAY1, CIRC12, DEST_URL, SCANNER, t=TIME1)
-RESULT_SUCCESS1 = ResultSuccess(RTTS, DOWNLOADS, RELAY1, CIRC12, DEST_URL,
+RESULT_SUCCESS1 = ResultSuccess(RTTS1, DOWNLOADS1, RELAY1, CIRC12, DEST_URL,
                                 SCANNER, t=TIME1)
-RESULT_SUCCESS2 = ResultSuccess(RTTS, DOWNLOADS, RELAY2, CIRC21, DEST_URL,
+RESULT_SUCCESS2 = ResultSuccess(RTTS2, DOWNLOADS2, RELAY2, CIRC21, DEST_URL,
                                 SCANNER, t=TIME2)
 RESULT_ERROR_STREAM = ResultErrorStream(RELAY1, CIRC12, DEST_URL, SCANNER,
                                         t=TIME1, msg="Something bad")
@@ -69,9 +106,9 @@ RESULT_ERROR_STREAM_DICT.update({
 
 RESULT_SUCCESS_DICT = BASE_RESULT_DICT.copy()
 RESULT_SUCCESS_DICT.update({
-    "rtts": RTTS,
+    "rtts": RTTS1,
     "type": "success",
-    "downloads": DOWNLOADS,
+    "downloads": DOWNLOADS1,
 })
 
 





More information about the tor-commits mailing list