Skip to content

E2E: harden test-resource naming and add post-suite cleanup #3398

@shouples

Description

@shouples

Companion to #3397. Even with the right env and cluster pinned, the E2E suite still relies on each test body to delete every resource it creates; any test that throws or crashes mid-flow leaves a topic/statement behind, and we have no global teardown that picks them up.

mcp-confluent follows a similar pattern in its integration suite with an int- prefix and a shared admin client that cleans up tracked names in afterAll. See tests/harness/unique-name.ts and the withSharedAdminClient() helper in that repo for the worked example.

Suggested approach

  • Adopt a uniform e2e-vscode- prefix for every test-created resource (topic, statement, subject, artifact). Names like e2e-produce-message-* are already close - pull them under the same prefix. A shared helper (e.g., e2eResourceName("produce")) would make this hard to forget at call sites.
  • Add a Playwright globalTeardown that lists topics, Flink statements, and any other test-scoped resources in the configured CCloud env+cluster and deletes anything matching the e2e-vscode- prefix older than ~1h. The "older than 1h" guard avoids stomping on concurrently-running CI jobs.
  • In the env-not-found error path from E2E: CCloud tests can land on the wrong environment and cluster #3397, list the env names that were visible so the next time CCloud renaming or org changes break the suite the failure points at the cause in one read.

Out of scope here: tightening the underlying API key / test-user permissions so the identity can't reach other envs at all. That's an infra / secret-rotation task that belongs elsewhere.

Metadata

Metadata

Labels

testingInvolves the test suite, click-testing, or tests running in CI

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions