Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add unit tests for InstanceMetadata

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

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
cloud, testing-qa

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.

Description

Kubernetes Cloud Controller Manager (CCM) Testing

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 NodeInternalIP addresses.
  • 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 InstanceNetworkInterfaceList and InstanceExternalIpList, asserted with errors.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.

Dominant language
Go
Stars
6
Forks
2
Avg merge
2h 5m
Merged PRs (30d)
14

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.

More from oxidecomputer/oxide-cloud-controller-manager

All issues in oxidecomputer/oxide-cloud-controller-manager

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.