oxidecomputer / oxidecomputer/oxide-cloud-controller-manager
Rework mockOxideClient to assert on request parameters
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6
- Forks
- 2
- Avg merge
- 2h 5m
- Merged PRs (30d)
- 14
Description
Context
The instances mock (mockOxideClient in internal/provider/instances_v2_test.go) returns canned outputs without inspecting request parameters, so the WithProviderID and NoProviderID subtests can't actually tell the two lookup paths apart — they assert the same thing today.
Scope
Convert mockOxideClient to the function-field fake style already used by fakeOxideLBClient in internal/provider/load_balancer_test.go (an unset function field fails the call loudly with errUnexpectedOxideCall). Then assert that:
- The provider-ID path calls
InstanceViewwith the instance ID (no project). - The name path calls
InstanceViewwith project + node name.
Done when
The two lookup paths in getInstance have distinguishable assertions, and any unexpected Oxide API call fails the test.
Contributor guide
No contributing guide indexed for this repository
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 with mockOxideClient and the WithProviderID and NoProviderID subtests in internal/provider/instances_v2_test.go, then compare the function-field fake style in internal/provider/load_balancer_test.go. Run the relevant internal/provider tests and verify that getInstance uses the expected InstanceView arguments for each path and that unexpected calls fail loudly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100