Skip to content

Add opt-in integration tests that leave persistent artifacts#33

Merged
jackparnell merged 1 commit intomainfrom
feature/persistent-integration-tests
Apr 12, 2026
Merged

Add opt-in integration tests that leave persistent artifacts#33
jackparnell merged 1 commit intomainfrom
feature/persistent-integration-tests

Conversation

@ColonistOne
Copy link
Copy Markdown
Collaborator

@ColonistOne ColonistOne commented Apr 12, 2026

Summary

The existing integration suite already covers create_post / create_comment / vote_post — but it cleans up after every test, so a successful run leaves no visible trace in the feed. That made it look as though the suite wasn't actually creating real artifacts.

This PR adds opt-in integration tests that deliberately don't clean up. Run them with COLONY_TEST_PERSIST=1 and you'll see real posts and comments appear in https://thecolony.cc/c/test-posts.

Tests

Test What it does Cleanup?
test_create_post_persists Creates a discussion post No
test_create_comment_persists Creates a post + comment No
test_upvote_persists Cross-user upvote of session test post Vote persists; post cleaned up
test_full_workflow_persists create + comment + cross-user upvote No

How to run

COLONY_TEST_API_KEY=col_xxx \
COLONY_TEST_API_KEY_2=col_yyy \
COLONY_TEST_PERSIST=1 \
    pytest tests/integration/test_persistent_artifacts.py -v -s

Without COLONY_TEST_PERSIST=1 the file is skipped entirely so the default suite still runs clean.

Important: Always use the dedicated is_tester test account API keys, never the production CMO key. Test account artifacts stay out of the main feed; production-account artifacts don't.

Verified live with test accounts

All 4 tests passed against the production API using the proper test-account keys:

Test plan

  • Module skips by default
  • Tests collect cleanly
  • Verified live against production with COLONY_TEST_PERSIST=1 and test accounts
  • ruff/format/mypy clean
  • Default unit suite still 346/346

🤖 Generated with Claude Code

The rest of the integration suite cleans up after itself, so a
successful run leaves no trace in the live feed even though it's
exercising the real create_post / create_comment / vote_post code
paths. That makes it hard to verify externally that the integration
tests are actually hitting the API.

These new tests are deliberately *not* cleaned up, so you can browse
https://thecolony.cc/c/test-posts and see the artifacts after a run.
They're gated behind COLONY_TEST_PERSIST=1 so the default suite
still runs clean.

  COLONY_TEST_API_KEY=col_xxx \
  COLONY_TEST_PERSIST=1 \
      pytest tests/integration/test_persistent_artifacts.py -v -s

4 tests:
- test_create_post_persists — creates a discussion post, leaves it
- test_create_comment_persists — creates a post + comment, leaves both
- test_upvote_persists — cross-user upvote of session test post
- test_full_workflow_persists — create post + comment + cross-user upvote

The vote tests skip cleanly when COLONY_TEST_API_KEY_2 isn't set
(server rejects self-votes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jackparnell jackparnell merged commit 9aaa3e8 into main Apr 12, 2026
7 checks passed
@jackparnell jackparnell deleted the feature/persistent-integration-tests branch April 12, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants