Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273"""A session an invalidation names is heard from the moment it is published.
A collection stream learns which sessions it follows from a database listing itruns after each invalidation. A child's first activity or mail, publishedbefore that listing finished, matched no filter and was dropped, and nothingreplayed it: under load a client following every session missed the newchild's first events (a suite failed on one of roughly twenty runs). The busadmits the named sessions into every filter as it publishes the invalidation.Only the daemon's real bus shows what a subscriber is admitted, so this runsthrough an inspected daemon."""
import unittest
from harness import ROOT, Albedo, Provider, exclusive, textfrom inspect_support import Inspection
@exclusiveclass BusFilterTests(unittest.TestCase): def test_an_invalidated_session_is_admitted_before_the_filter_refreshes(self): provider = Provider(lambda request: text("ok")) self.addCleanup(provider.close)
def prepare(app): app.daemon.env["ALBEDO_INSPECT"] = "1"
with Albedo(provider, prepare=prepare) as app: probe = Inspection(app, ROOT / "e2e/albedo_bus_filter_probe.erl") report = probe.call_json("invalidated_session_events") self.assertEqual( report["events"], ["invalidate child", "child activity", "mail to child"], ) self.assertTrue(report["invalidated"])
def test_stale_refresh_preserves_new_members_until_a_fresh_refresh(self): self.check_probe( "stale_refresh", { "before": ["invalidate child", "child activity", "child mail"], "global": ["global invalidate", "after global invalidate"], "after_refresh": [], "closed": [], }, )
def test_membership_retains_sessions_that_move_above_a_page_cursor(self): self.check_probe( "moving_membership", { "tail_count": 4, "count": 205, "moved_present": True, "frequent_count": 205, }, )
def check_probe(self, function, expected): provider = Provider(lambda request: text("ok")) self.addCleanup(provider.close)
def prepare(app): app.daemon.env["ALBEDO_INSPECT"] = "1"
with Albedo(provider, prepare=prepare) as app: probe = Inspection(app, ROOT / "e2e/albedo_bus_filter_probe.erl") self.assertEqual(probe.call_json(function), expected)
if __name__ == "__main__": unittest.main()