mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
CheckResults: simplify self._data
This commit is contained in:
parent
e313cf6406
commit
d446897282
@ -12,9 +12,6 @@ class CheckResults:
|
||||
self.uri = uri
|
||||
self.storage_index = storage_index
|
||||
self.problems = []
|
||||
self._data = {"count-corrupt-shares": 0,
|
||||
"list-corrupt-shares": [],
|
||||
}
|
||||
self.summary = ""
|
||||
self.report = []
|
||||
|
||||
@ -34,7 +31,7 @@ class CheckResults:
|
||||
def set_needs_rebalancing(self, needs_rebalancing):
|
||||
self.needs_rebalancing_p = bool(needs_rebalancing)
|
||||
def set_data(self, data):
|
||||
self._data.update(data)
|
||||
self._data = data
|
||||
def set_summary(self, summary):
|
||||
assert isinstance(summary, str) # should be a single string
|
||||
self.summary = summary
|
||||
|
@ -73,6 +73,7 @@ class FakeCHKFileNode:
|
||||
data["count-good-share-hosts"] = 10
|
||||
data["count-wrong-shares"] = 0
|
||||
nodeid = "\x00"*20
|
||||
data["count-corrupt-shares"] = 0
|
||||
data["list-corrupt-shares"] = []
|
||||
data["sharemap"] = {1: [nodeid]}
|
||||
data["servers-responding"] = [nodeid]
|
||||
@ -281,6 +282,7 @@ class FakeMutableFileNode:
|
||||
data["count-shares-expected"] = 10
|
||||
data["count-good-share-hosts"] = 10
|
||||
data["count-wrong-shares"] = 0
|
||||
data["count-corrupt-shares"] = 0
|
||||
data["list-corrupt-shares"] = []
|
||||
nodeid = "\x00"*20
|
||||
data["sharemap"] = {"seq1-abcd-sh0": [nodeid]}
|
||||
|
@ -89,6 +89,7 @@ class WebResultsRendering(unittest.TestCase, WebRenderingMixin):
|
||||
"count-shares-expected": 9,
|
||||
"count-shares-good": 10,
|
||||
"count-good-share-hosts": 11,
|
||||
"count-corrupt-shares": 0,
|
||||
"list-corrupt-shares": [],
|
||||
"count-wrong-shares": 0,
|
||||
"sharemap": {"shareid1": [serverid_1, serverid_f]},
|
||||
@ -121,6 +122,7 @@ class WebResultsRendering(unittest.TestCase, WebRenderingMixin):
|
||||
cr.set_healthy(False)
|
||||
cr.set_recoverable(False)
|
||||
cr.set_summary("rather dead")
|
||||
data["count-corrupt-shares"] = 1
|
||||
data["list-corrupt-shares"] = [(serverid_1, u.get_storage_index(), 2)]
|
||||
cr.set_data(data)
|
||||
html = self.render2(w)
|
||||
@ -159,7 +161,7 @@ class WebResultsRendering(unittest.TestCase, WebRenderingMixin):
|
||||
'count-good-share-hosts': 11,
|
||||
'count-wrong-shares': 0,
|
||||
'count-shares-good': 10,
|
||||
'count-corrupt-shares': 0,
|
||||
'count-corrupt-shares': 1,
|
||||
'servers-responding': [],
|
||||
'recoverable': False,
|
||||
}
|
||||
@ -189,6 +191,7 @@ class WebResultsRendering(unittest.TestCase, WebRenderingMixin):
|
||||
"count-shares-expected": 10,
|
||||
"count-shares-good": 6,
|
||||
"count-good-share-hosts": 7,
|
||||
"count-corrupt-shares": 0,
|
||||
"list-corrupt-shares": [],
|
||||
"count-wrong-shares": 0,
|
||||
"sharemap": {"shareid1": [serverid_1, serverid_f]},
|
||||
@ -207,6 +210,7 @@ class WebResultsRendering(unittest.TestCase, WebRenderingMixin):
|
||||
"count-shares-expected": 10,
|
||||
"count-shares-good": 10,
|
||||
"count-good-share-hosts": 11,
|
||||
"count-corrupt-shares": 0,
|
||||
"list-corrupt-shares": [],
|
||||
"count-wrong-shares": 0,
|
||||
"sharemap": {"shareid1": [serverid_1, serverid_f]},
|
||||
|
Loading…
Reference in New Issue
Block a user