Admin post-weekly command and GoToSocial post interop checks (phase 3, step 10)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m8s
CI / test (push) Successful in 2m56s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m8s
CI / test (push) Successful in 2m56s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
`flask federation post-weekly --user <name> --now` posts a user's
summary for the week still in progress immediately, ignoring the
Monday-09:00 gate - for operators, and so the interop test can produce
a real post without waiting on calendar time. Backed by a new
weekly.post_now(), sharing _post_for_window() with the normal
check_and_post() path so both go through the same has_post/empty-week/
publish logic; only the window (this week so far, vs. the last gated
one) differs.
Extends the GoToSocial interop driver to a second phase: run.sh seeds
one scrobble directly (the driver container has no way to sign a
Last.fm-API request, and doesn't need one just to seed data), triggers
the CLI command via `docker compose exec api`, then re-runs the driver
with --check-posts to confirm the post reaches the already-following
GoToSocial account's home timeline as `private` (followers-only, our
default) with the expected content, deletes it via the existing
DELETE /posts/{id} API, and confirms it disappears from GoToSocial's
timeline too. The main flow now ends by re-following instead of the
previous test's decline, so the post-check phase has a follower to
check against.
Verified end to end against a real GoToSocial 0.22.1 container locally
before pushing (scripts/interop/run.sh), not just left to CI:
private post: '<p><strong>My week in music: 1 play</strong></p>...'
All post interop checks passed
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
1 parent
de1519a066
commit
860d4d0f93
8 files changed
+244
-8
No files matched your search
@@ -210,6 +210,12 @@ class Scrobbler:
|
||||
if status not in (200, 204):
|
||||
fail(f"{action} follower: {status} {body}")
|
||||
|
||||
def posts(self):
|
||||
status, body = api("GET", f"{SCROBBLER_API}/federation/posts", self.token)
|
||||
if status != 200:
|
||||
fail(f"listing posts: {status} {body}")
|
||||
return body
|
||||
|
||||
|
||||
class GoToSocial:
|
||||
def __init__(self, token):
|
||||
@@ -249,6 +255,12 @@ class GoToSocial:
|
||||
fail(f"relationship: {status} {body}")
|
||||
return body[0]
|
||||
|
||||
def home_timeline(self):
|
||||
status, body = api("GET", f"{GTS}/api/v1/timelines/home", self.token)
|
||||
if status != 200:
|
||||
fail(f"home timeline: {status} {body}")
|
||||
return body
|
||||
|
||||
|
||||
def main():
|
||||
step("Getting a GoToSocial access token")
|
||||
@@ -347,8 +359,54 @@ def main():
|
||||
),
|
||||
)
|
||||
|
||||
step("Re-follow: left in place for the post check (run.sh's second driver pass)")
|
||||
alice.settings(manually_approves_followers=False)
|
||||
gts.follow(account_id)
|
||||
wait_for("GoToSocial to be following", lambda: gts.relationship(account_id)["following"])
|
||||
|
||||
step("All interop checks passed")
|
||||
|
||||
|
||||
def check_posts():
|
||||
"""Second phase, run by run.sh after it triggers `flask federation post-weekly
|
||||
--now` directly in the api container (this container has no docker access to do that
|
||||
itself). Checks the post reaches the already-following GoToSocial account's home
|
||||
timeline as a private (followers-only) status with the expected text, then deletes
|
||||
it and checks it disappears there too."""
|
||||
step("Getting a GoToSocial access token")
|
||||
gts = GoToSocial(gotosocial_token())
|
||||
alice = Scrobbler() # register-or-login: the same account main() set up
|
||||
account = gts.resolve("@alice@scrobble.test")
|
||||
account_id = account["id"]
|
||||
if not gts.relationship(account_id)["following"]:
|
||||
fail("GoToSocial isn't following alice; run the main interop flow first")
|
||||
|
||||
step("The weekly summary reaches GoToSocial's home timeline")
|
||||
posted = wait_for(
|
||||
"the weekly summary in GoToSocial's home timeline",
|
||||
lambda: next(
|
||||
(s for s in gts.home_timeline() if s["account"]["acct"] == "alice@scrobble.test"),
|
||||
None,
|
||||
),
|
||||
)
|
||||
if posted["visibility"] != "private":
|
||||
fail(f"expected private (followers-only) visibility, got {posted['visibility']!r}")
|
||||
if "My week in music" not in posted["content"]:
|
||||
fail(f"unexpected content: {posted['content']!r}")
|
||||
print(f" {posted['visibility']} post: {posted['content'][:80]!r}")
|
||||
|
||||
step("Deleting the post removes it from GoToSocial too")
|
||||
[post, *_] = alice.posts()
|
||||
status, body = api("DELETE", f"{SCROBBLER_API}/federation/posts/{post['id']}", alice.token)
|
||||
if status != 204:
|
||||
fail(f"deleting the post: {status} {body}")
|
||||
wait_for(
|
||||
"the post to disappear from GoToSocial's home timeline",
|
||||
lambda: not any(s["id"] == posted["id"] for s in gts.home_timeline()),
|
||||
)
|
||||
|
||||
step("All post interop checks passed")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
check_posts() if "--check-posts" in sys.argv[1:] else main()
|
||||
Reference in new issue
Block a user