oxidecomputer / oxidecomputer/oxide-cloud-controller-manager

Rework mockOxideClient to assert on request parameters

Open Beginner friendly
#261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Kubernetes Cloud Controller Manager (CCM) Testing
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 InstanceView with the instance ID (no project).
  • The name path calls InstanceView with 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

  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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.