Skip to content

Migrate E2E to use ginkgo's DeferCleanup #1464

Todo

Description

@olivergondza

Is your task related to a problem? Please describe.

In E2E tests, avoid cleanup using defer or AfterEach. Use ginko's DeferCleanup instead.

It has got several benefits:

  • The setup and cleanup is collocated. Now the cleanup is in AfterEach but the setup is in either BeforeEach or in It. This adds slight cognitive complexity to each suite.
  • There is no need to save all state needed for cleanup only - typically "cleanup" functions. This reduces the number of spec variables needed. Also simplify AfterEach code, especially in case of multiple resources acquired one-after-another.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Activity

  1. Gabrielandre02 commented on Dec 4, 2026

    @Gabrielandre02
    Contributor

    /assign

  2. Gabrielandre02 commented on Dec 4, 2026

    @Gabrielandre02
    Contributor

    I opened #1634 and #1635 for the parallel specs and the simpler sequential ones. The remaining specs restore the Subscription, remove finalizers or touch the default instance in AfterEach, where the cleanup order matters. Is it worth migrating those too, or would you rather leave them as they are?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions