From: Christian Grothoff Date: Mon, 18 Feb 2019 23:35:44 +0000 (+0100) Subject: cleaner py code, fix test_integration_disconnect.py.in by fixing erroneous patch X-Git-Tag: v0.11.0~63^2~32^2~32 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e7857ff6408f917a2ca57185def5596274569e11;p=oweals%2Fgnunet.git cleaner py code, fix test_integration_disconnect.py.in by fixing erroneous patch --- diff --git a/src/integration-tests/gnunet_testing.py.in b/src/integration-tests/gnunet_testing.py.in index 5767a455a..639776fe0 100644 --- a/src/integration-tests/gnunet_testing.py.in +++ b/src/integration-tests/gnunet_testing.py.in @@ -170,13 +170,13 @@ class StatisticsCondition(Condition): self.peer = peer self.subsystem = subsystem self.name = name - self.value = value + self.value = str(value) self.result = -1 def check(self): if (self.fulfilled == False): self.result = self.peer.get_statistics_value(self.subsystem, self.name) - if (self.result == str(self.value)): + if (self.result == self.value): self.fulfilled = True return True else: @@ -206,7 +206,7 @@ class StatisticsCondition(Condition): # op + # res + # fail) - logger.debug('%s %s %s condition in subsystem %s : %s : (expected/real value) %s %s %s %s', self.peer.id[:4], self.peer.cfg.encode('utf-8'), str(self.type).encode('utf-8'), self.subsystem.encode('utf-8').ljust(12), self.name.encode('utf-8').ljust(30), str(self.value).encode('utf-8'), op, self.result, fail) + logger.debug('%s %s %s condition in subsystem %s : %s : (expected/real value) %s %s %s %s', self.peer.id[:4], self.peer.cfg, str(self.type), self.subsystem.ljust(12), self.name.ljust(30), self.value, op, self.result, fail) return self.fulfilled @@ -267,7 +267,7 @@ class EqualStatisticsCondition(Condition): # self.name2.encode('utf-8').ljust(30) + # b'" ' + # self.result2) - logger.debug('%s %s %s == %s %s %s %s %s', self.peer.id[:4], self.subsystem.encode('utf-8').ljust(12), self.name.encode('utf-8').ljust(30), self.result, self.peer2.id[:4], self.subsystem2.encode('uft-8').ljust(12), self.name2.encode('utf-8').ljust(30), self.result2) + logger.debug('%s %s %s == %s %s %s %s %s', self.peer.id[:4], self.subsystem.ljust(12), self.name.ljust(30), self.result, self.peer2.id[:4], self.subsystem2.ljust(12), self.name2.ljust(30), self.result2) return self.fulfilled @@ -375,12 +375,10 @@ class Peer(object): if os.name == 'nt' and tests[1] == b'\n' and tests[0][-1] == b'\r': tests = (tests[0][:-1], tests[1], tests[2]) tests = tests[0] - # print("running gnunet-statistics " + self.cfg + " for " + name + "/" + subsystem + " yields " + tests.decode("utf-8")) - logger.debug('running gnunet-statistics %s for %s "/" %s yields %s', self.cfg, name, subsystem, test.decode("utf-8")) result = tests.decode("utf-8").strip() + logger.debug('running gnunet-statistics %s for %s "/" %s yields %s', self.cfg, name, subsystem, result) if (result.isdigit() == True): return result else: - # print("Invalid statistics value: " + str(tests) + " is not a number!") logger.debug('Invalid statistics value: %s is not a number!', result) return -1 diff --git a/src/integration-tests/test_integration_disconnect.py.in b/src/integration-tests/test_integration_disconnect.py.in index e1e431a0a..a81c78540 100755 --- a/src/integration-tests/test_integration_disconnect.py.in +++ b/src/integration-tests/test_integration_disconnect.py.in @@ -108,17 +108,17 @@ def fail_connect_cont (check): def check_connect (): check = Check (test) - check.add (StatisticsCondition (client, 'transport', '# peers connected',2)) - check.add (StatisticsCondition (client, 'core', '# peers connected',2)) - check.add (StatisticsCondition (client, 'topology', '# peers connected',2)) - check.add (StatisticsCondition (client, 'dht', '# peers connected',2)) - check.add (StatisticsCondition (client, 'fs', '# peers connected',2)) - - check.add (StatisticsCondition (server, 'transport', '# peers connected',2)) - check.add (StatisticsCondition (server, 'core', '# peers connected',2)) - check.add (StatisticsCondition (server, 'topology', '# peers connected',2)) - check.add (StatisticsCondition (server, 'dht', '# peers connected',2)) - check.add (StatisticsCondition (server, 'fs', '# peers connected',2)) + check.add (StatisticsCondition (server, 'transport', '# peers connected',1)) + check.add (StatisticsCondition (server, 'core', '# peers connected',1)) + check.add (StatisticsCondition (server, 'topology', '# peers connected',1)) + check.add (StatisticsCondition (server, 'dht', '# peers connected',1)) + check.add (StatisticsCondition (server, 'fs', '# peers connected',1)) + + check.add (StatisticsCondition (client, 'transport', '# peers connected',1)) + check.add (StatisticsCondition (client, 'core', '# peers connected',1)) + check.add (StatisticsCondition (client, 'topology', '# peers connected',1)) + check.add (StatisticsCondition (client, 'dht', '# peers connected',1)) + check.add (StatisticsCondition (client, 'fs', '# peers connected',1)) check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont)