stackabletech / stackabletech/operator-rs

Code using `ObjectMetaBuilder::ownerreference_from_resource()` is not unit testable

Open
#740 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
167
Forks
19
Avg merge
1d 6h
Merged PRs (30d)
9

Description

Description

Currently it's impossible to write unit tests for code that calls ObjectMetaBuilder::ownerreference_from_resource(). This is because OwnerReferenceBuilder::build() checks for the uid key which is cannot be set in tests.

Unfortunately this affects pretty much all operator code.

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 in src/builder/meta.rs, reading ObjectMetaBuilder::ownerreference_from_resource() and OwnerReferenceBuilder::build(). Trace how build() requires uid, then add focused unit coverage for the test scenario described in the issue. Done means callers can be unit tested without needing to set a Kubernetes uid.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
infrastructure, testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.