Skip to content

E2E: Auto-cleanup leftover resources if teardown failures #7318

@phyllis-sy-wu

Description

@phyllis-sy-wu

Problem/Feature
When E2E teardown fails (store deletion timeout, 500 errors, etc.), leftover apps and stores accumulate. Currently these would require manual cleanup via cleanup-apps.ts / cleanup-stores.ts (WIP)

Proposed solution:

  1. teardownAll writes leftover resource info to test-results/teardown-leftovers.json when any phase fails (app name, store slug, what failed)
  2. A post-test CI step checks if that file exists and is non-empty
  3. If leftovers exist, run the cleanup scripts targeting just those resources
  4. If no leftovers, skip entirely (zero cost on clean runs)
- name: Cleanup leftovers
  if: ${{ !cancelled() && hashFiles('packages/e2e/test-results/teardown-leftovers.json') != '' }}
  run: npx tsx scripts/cleanup-stores.ts && npx tsx scripts/cleanup-apps.ts

Benefits:

  • No extra cost on clean runs (no browser launch)
  • Only pays ~2-3 min cleanup when there are actual leftovers
  • Could pass specific --pattern flags to target just the failed resources instead of scanning everything

Depends on: cleanup scripts PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions