def check(self):
if (self.fulfilled == False):
self.result = self.peer.get_statistics_value(self.subsystem, self.name)
- if (str(self.result) == str(self.value)):
+ if (self.result == str(self.value)):
self.fulfilled = True
return True
else:
return True
def evaluate(self, failed_only):
- if (self.result == -1):
- res = b'NaN'
- else:
- res = str(self.result).encode('utf-8')
if (self.fulfilled == False):
fail = b" FAIL!"
op = b" != "
# 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, 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)
return self.fulfilled
if (self.fulfilled == False):
self.result = self.peer.get_statistics_value(self.subsystem, self.name)
self.result2 = self.peer2.get_statistics_value(self.subsystem2, self.name2)
- if (str(self.result) == str(self.result2)):
+ if (self.result == self.result2):
self.fulfilled = True
return True
else:
if (self.result == -1):
res = b'NaN'
else:
- res = str(self.result).encode('utf-8')
+ res = self.result
if (self.result2 == -1):
res2 = b'NaN'
else:
- res2 = str(self.result2).encode('utf-8')
+ res2 = self.result2
if (self.fulfilled == False):
fail = b" FAIL!"
op = b" != "
# b'" "' +
# self.name.encode('utf-8').ljust(30) +
# b'" == ' +
- # str(self.result).encode('utf-8') +
+ # self.result +
# b" " +
# self.peer2.id[:4] +
# b' "' +
# b'" ' +
# self.name2.encode('utf-8').ljust(30) +
# b'" ' +
- # str(self.result2).encode('utf-8'))
- 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), str(self.result).encode('utf-8'), self.peer2.id[:4], self.subsystem2.encode('uft-8').ljust(12), self.name2.encode('utf-8').ljust(30), str(self.result2).encode('utf-8'))
+ # 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)
return self.fulfilled
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"))
- if (tests.isdigit() == True):
- return tests
+ 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()
+ 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!', str(tests))
+ logger.debug('Invalid statistics value: %s is not a number!', result)
return -1