Skip to content

fix: TestStatusWaitForDelete flakes due to WaitForDelete informer initialization race #32261

Description

@gjenkins8

What happened?

During informer sync, resources briefly report as Unknown. Causing the observer to cancel the watch early, causing intermittent test flakes.

statusObserver skips Unknown resources when desired == NotFoundStatus, so if all resources happen to be in that transient state the filtered list (rss) is empty. aggregator.AggregateStatus on an empty slice returns the desired status, causing cancel() to fire immediately — before any real status event is delivered. The watch exits without hitting the deadline, so ctx.Err() returns nil, and the test assertion for "context deadline exceeded" fails.

PR attempted to fix, but #32081 caused #32214 (#32081 was then reverted)

What did you expect to happen?

WaitForDelete needs to handle transient informer initialization behavior, and not assume Unknown resources can be skipped.

The fix must include some sort of testing to show that object which are expected to be deleted e.g. hook objects which utilize helm.sh/hook-delete-policy: before-hook-creation are successfully "waited" (ie. skipped).

How can we reproduce it (as minimally and precisely as possible)?

Repeated runs of TestStatusWaitForDelete

Helm version

Details
$ helm version
version.BuildInfo{Version:"v4.2.2", GitCommit:"b05881cf967a5a09e19866799d0edfd40675803a", GitTreeState:"clean", GoVersion:"go1.26.4", KubeClientVersion:"v1.36"}

Kubernetes version

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Fields

    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