summaryrefslogtreecommitdiff
path: root/src/dht/test_dht_tools.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/test_dht_tools.py.in')
-rw-r--r--src/dht/test_dht_tools.py.in29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/dht/test_dht_tools.py.in b/src/dht/test_dht_tools.py.in
index 2d9379a42..c2f95e4b5 100644
--- a/src/dht/test_dht_tools.py.in
+++ b/src/dht/test_dht_tools.py.in
@@ -94,20 +94,34 @@ def r_put(extra_args, **kw):
94def end_arm_failer(command, rc, stdo, stde, normal): 94def end_arm_failer(command, rc, stdo, stde, normal):
95 if normal: 95 if normal:
96 if rc != 0: 96 if rc != 0:
97 fail("FAIL: error running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) 97 fail(
98 "FAIL: error running {}\nCommand output was:\n{}\n{}".format(
99 command, stdo, stde
100 )
101 )
98 else: 102 else:
99 if rc == 0: 103 if rc == 0:
100 fail("FAIL: expected error while running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) 104 fail(
105 "FAIL: expected error while running {}\nCommand output was:\n{}\n{}"
106 .format(command, stdo, stde)
107 )
101 108
102 109
103def print_only_failer(command, rc, stdo, stde, normal): 110def print_only_failer(command, rc, stdo, stde, normal):
104 if normal: 111 if normal:
105 if rc != 0: 112 if rc != 0:
106 print("FAIL: error running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) 113 print(
114 "FAIL: error running {}\nCommand output was:\n{}\n{}".format(
115 command, stdo, stde
116 )
117 )
107 cleanup(1) 118 cleanup(1)
108 else: 119 else:
109 if rc == 0: 120 if rc == 0:
110 print("FAIL: expected error while running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) 121 print(
122 "FAIL: expected error while running {}\nCommand output was:\n{}\n{}"
123 .format(command, stdo, stde)
124 )
111 cleanup(1) 125 cleanup(1)
112 126
113 127
@@ -122,10 +136,13 @@ print("PASS")
122time.sleep(1) 136time.sleep(1)
123 137
124print("TEST: Testing get...", end='') 138print("TEST: Testing get...", end='')
125rc, stdo, stde = r_get(['-k', 'testkey', '-T', '50 ms', '-t', '8'], want_stdo=True, failer=end_arm_failer) 139rc, stdo, stde = r_get(['-k', 'testkey', '-T', '50 ms', '-t', '8'],
140 want_stdo=True,
141 failer=end_arm_failer)
126stdo = stdo.decode('utf-8').replace('\r', '').splitlines() 142stdo = stdo.decode('utf-8').replace('\r', '').splitlines()
127expect = "Result 0, type 8:\ntestdata".splitlines() 143expect = "Result 0, type 8:\ntestdata".splitlines()
128if len(stdo) != 2 or len(expect) != 2 or stdo[0] != expect[0] or stdo[1] != expect[1]: 144if len(stdo) != 2 or len(expect
145 ) != 2 or stdo[0] != expect[0] or stdo[1] != expect[1]:
129 fail("output `{}' differs from expected `{}'".format(stdo, expect)) 146 fail("output `{}' differs from expected `{}'".format(stdo, expect))
130print("PASS") 147print("PASS")
131 148