kubernetes-sigs / kubernetes-sigs/controller-runtime
Allow unittesting indexes on the cache-backed reader
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3k
- Forks
- 1.3k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 14
Description
Currently, the only way of testing if:
- An index actually gets added to the cache
- Using the index yields the expected result
is to use envtest, which spins up an etcd and apiserver. Doing so works fine, but requires more setup (the binaries must be available) and has a decent chance of flaking in CI, e.G. due to CPU starvation.
It would be nice if there was a way to test the two cases above via pure unittests.
Discussion originally started here: https://github.com/kubernetes/test-infra/pull/14830#discussion_r336232996
/kind feature
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the cache-backed reader and the existing envtest-based tests that exercise its indexes. Compare what those tests verify with the setup provided by etcd and the apiserver, then determine how equivalent pure unit tests could cover index insertion and indexed lookup. Done means both behaviors are tested without requiring envtest binaries or an apiserver.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100