kubernetes-sigs / kubernetes-sigs/controller-runtime

Can't delete namespaces from test environment

Open
#880 22 comments 19 reactions 0 assignees View on GitHub
kind/feature lifecycle/frozen priority/important-longterm
Dominant language
Go
Stars
3k
Forks
1.3k
Avg merge
2d 5h
Merged PRs (30d)
14

Description

I'd like to use namespaces to isolate my tests from one another. For example, I want to create a new namespace with a random name in my `BeforeEach` and delete it in `AfterEach` so that individual tests don't have to worry about cleaning up after themselves.

However, I've observed that namespace deletion doesn't work when using `envtest`. When I delete a namespace, the deletion timestamp on resources within that namespace remain unset, and the namespace stays in the `Terminating` phase seemingly forever. The latter is true even if the namespace is empty (e.g. I delete it immediately after creating it).

Is this behavior expected? Is whatever mechanism that normally executes namespace deletion missing from `envtest`?

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by reproducing namespace creation and deletion in envtest, then inspect resource deletion timestamps and the namespace phase; done should establish whether this behavior is expected and, if not, verify that deletion completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.