kubernetes-sigs / kubernetes-sigs/controller-runtime

Allow unittesting indexes on the cache-backed reader

Open
#657 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted kind/feature lifecycle/frozen priority/backlog
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.