Retain completed status batches as routine observations
This commit is contained in:
+3
-2
@@ -32,7 +32,7 @@ import urllib.parse
|
||||
import urllib.request
|
||||
import uuid
|
||||
|
||||
VERSION = "1.4.13"
|
||||
VERSION = "1.4.14"
|
||||
LABEL = "io.electric-cherry"
|
||||
MAX_FILE = 32 * 1024 * 1024
|
||||
MANIFEST_MAX_ENTRIES = 10000
|
||||
@@ -1393,7 +1393,8 @@ class Agent:
|
||||
|
||||
with ThreadPoolExecutor(max_workers=2) as executor:
|
||||
results = list(executor.map(probe, identities))
|
||||
return {"ok": all(row["reply"].get("ok") for row in results), "results": results}
|
||||
# Completion describes the batch; individual failures remain in each reply.
|
||||
return {"ok": True, "results": results}
|
||||
|
||||
def rcon(self, instance_id, generation, command, deadline=None, status_attempts=3):
|
||||
if not isinstance(command, str) or not command or len(command) > 2048 or any(ch in command for ch in ("\x00", "\r", "\n")):
|
||||
|
||||
@@ -114,6 +114,12 @@ class JournalRetentionTests(unittest.TestCase):
|
||||
self.assertFalse(accepted)
|
||||
self.assertEqual(saved["id"], row["id"])
|
||||
|
||||
def test_completed_batch_with_failed_targets_is_pruned_after_acknowledgment(self):
|
||||
result = {"ok": True, "results": [{"instanceId": INSTANCE, "generation": 1,
|
||||
"reply": {"ok": False, "reason": "timeout", "text": ""}}]}
|
||||
self.record("rcon.status-batch", {"instances": [{"instanceId": INSTANCE, "generation": 1}]}, result)
|
||||
self.assertEqual(self.prune(), 1)
|
||||
|
||||
def test_errors_failures_and_unfinished_operations_are_retained(self):
|
||||
retained = [self.record(result=result) for result in ({"ok": False}, {"healthy": False}, {"error": "partial result"}, {"error": False}, {"error": []})]
|
||||
retained.append(self.record(error="read did not finish"))
|
||||
@@ -644,7 +650,7 @@ class AgentTests(unittest.TestCase):
|
||||
self.assertFalse(thread.is_alive())
|
||||
self.assertEqual(peak, 2)
|
||||
self.assertEqual(len(results[0]["results"]), 5)
|
||||
self.assertFalse(results[0]["ok"])
|
||||
self.assertTrue(results[0]["ok"])
|
||||
self.assertEqual(results[0]["results"][2]["reply"]["reason"], "unreachable")
|
||||
self.assertTrue(results[0]["results"][4]["reply"]["ok"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user