[svn r38035] be more precise when reporting about hosts
(enumerate them) --HG-- branch : trunk
This commit is contained in:
parent
1d4a46d46a
commit
563ed75651
|
@ -25,7 +25,7 @@ class HostInfo(object):
|
|||
|
||||
def _getuniqueid(self, hostname):
|
||||
l = self._hostname2list.setdefault(hostname, [])
|
||||
hostid = hostname + "_" * len(l)
|
||||
hostid = hostname + "[%d]" % len(l)
|
||||
l.append(hostid)
|
||||
return hostid
|
||||
|
||||
|
|
|
@ -57,13 +57,15 @@ class AbstractReporter(object):
|
|||
address)
|
||||
|
||||
def report_HostRSyncing(self, item):
|
||||
print "%10s: RSYNC ==> %s" % (item.host.hostname[:10],
|
||||
hostrepr = self._hostrepr(item.host)
|
||||
print "%15s: RSYNC ==> %s" % (hostrepr,
|
||||
item.host.relpath)
|
||||
|
||||
def report_HostGatewayReady(self, item):
|
||||
self.to_rsync[item.host] = len(item.roots)
|
||||
self.out.write("%10s: gateway initialised (remote topdir: %s)\n"\
|
||||
% (item.host.hostname, item.host.gw_remotepath))
|
||||
hostrepr = self._hostrepr(item.host)
|
||||
self.out.write("%15s: gateway initialised (remote topdir: %s)\n"\
|
||||
% (hostrepr, item.host.gw_remotepath))
|
||||
|
||||
def report_HostRSyncRootReady(self, item):
|
||||
self.to_rsync[item.host] -= 1
|
||||
|
@ -72,15 +74,16 @@ class AbstractReporter(object):
|
|||
|
||||
def _host_ready(self, item):
|
||||
self.hosts_to_rsync -= 1
|
||||
hostrepr = self._hostrepr(item.host)
|
||||
if self.hosts_to_rsync:
|
||||
print "%10s: READY (still %d to go)" % (item.host.hostname[:10],
|
||||
self.hosts_to_rsync)
|
||||
print "%15s: READY (still %d to go)" % (hostrepr,
|
||||
self.hosts_to_rsync)
|
||||
else:
|
||||
print "%10s: READY" % item.host.hostname[:10]
|
||||
print "%15s: READY" % hostrepr
|
||||
|
||||
def report_TestStarted(self, item):
|
||||
hostnames = [host.hostname for host in item.hosts]
|
||||
txt = " Test started, hosts: %s " % ", ".join(hostnames)
|
||||
hostreprs = [self._hostrepr(host) for host in item.hosts]
|
||||
txt = " Test started, hosts: %s " % ", ".join(hostreprs)
|
||||
self.hosts_to_rsync = len(item.hosts)
|
||||
self.out.sep("=", txt)
|
||||
self.timestart = item.timestart
|
||||
|
@ -164,6 +167,9 @@ class AbstractReporter(object):
|
|||
self.out.line("Received signal: %d" % outcome.signal)
|
||||
self.repr_out_err(outcome)
|
||||
|
||||
def _hostrepr(self, host):
|
||||
return host.hostid
|
||||
|
||||
def skips(self):
|
||||
texts = {}
|
||||
for event in self.skipped_tests_outcome:
|
||||
|
@ -223,17 +229,18 @@ class AbstractReporter(object):
|
|||
|
||||
def report_ReceivedItemOutcome(self, event):
|
||||
host = event.host
|
||||
hostrepr = self._hostrepr(host)
|
||||
if event.outcome.passed:
|
||||
self.passed[host] += 1
|
||||
sys.stdout.write("%10s: PASSED " % host.hostname[:10])
|
||||
sys.stdout.write("%15s: PASSED " % hostrepr)
|
||||
elif event.outcome.skipped:
|
||||
self.skipped_tests_outcome.append(event)
|
||||
self.skipped[host] += 1
|
||||
sys.stdout.write("%10s: SKIPPED " % host.hostname[:10])
|
||||
sys.stdout.write("%15s: SKIPPED " % hostrepr)
|
||||
else:
|
||||
self.failed[host] += 1
|
||||
self.failed_tests_outcome.append(event)
|
||||
sys.stdout.write("%10s: " % host.hostname[:10])
|
||||
sys.stdout.write("%15s: " % hostrepr)
|
||||
ansi_print("FAILED", esc=(31,1), newline=False, file=sys.stdout)
|
||||
sys.stdout.write(" ")
|
||||
# we should have printed 20 characters to this point
|
||||
|
|
|
@ -157,12 +157,15 @@ class AbstractTestReporter(BasicRsessionTest):
|
|||
r.report(repevent.HostRSyncRootReady(host, root))
|
||||
out, err = cap.reset()
|
||||
assert not err
|
||||
expected1 = "Test started, hosts: host1, host2, host3"
|
||||
expected2 = """host1: READY (still 2 to go)
|
||||
host2: READY (still 1 to go)
|
||||
host3: READY"""
|
||||
expected1 = "Test started, hosts: host1[0], host2[0], host3[0]"
|
||||
assert out.find(expected1) != -1
|
||||
assert out.find(expected2) != -1
|
||||
for expected in py.code.Source("""
|
||||
host1[0]: READY (still 2 to go)
|
||||
host2[0]: READY (still 1 to go)
|
||||
host3[0]: READY
|
||||
""").lines:
|
||||
expected = expected.strip()
|
||||
assert out.find(expected) != -1
|
||||
|
||||
class TestLocalReporter(AbstractTestReporter):
|
||||
reporter = LocalReporter
|
||||
|
|
Loading…
Reference in New Issue