oxidecomputer / oxidecomputer/oxide-cloud-controller-manager
Add unit tests for InstanceMetadata
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6
- Forks
- 2
- Avg merge
- 2h 5m
- Merged PRs (30d)
- 14
Description
Context
InstanceMetadata (internal/provider/instances_v2.go) is the most complex function in InstancesV2 — NIC dual-stack handling, SNAT filtering, external IP mapping, provider ID formatting — and it has zero test coverage today, even though the mock already has fields to fake its inputs.
Scope
Add unit tests covering:
- v4-only, v6-only, and dual-stack NICs mapping to
NodeInternalIPaddresses. - SNAT external IPs being skipped.
- Ephemeral and floating external IPs mapping to
NodeExternalIP. - Hostname address always present.
- Provider ID formatting (
oxide://<uuid>). - Instance-type string (
<ncpus>-<memory GiB>). - Error paths for
InstanceNetworkInterfaceListandInstanceExternalIpList, asserted witherrors.Is.
Done when
Each NIC/external-IP shape has a test and both error paths are asserted.
Blocked by the mock rework (parameter-asserting fakes) — build these tests on the new fake style.
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
Read InstanceMetadata in internal/provider/instances_v2.go and inspect the mock rework's parameter-asserting fake style first. Add coverage for each NIC and external-IP shape, hostname, provider ID, instance type, and both InstanceNetworkInterfaceList and InstanceExternalIpList error paths, asserting errors.Is; done means every listed shape and both errors are tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cloud, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100