oxidecomputer / oxidecomputer/packer-plugin-oxide
Add unit tests for pure logic (Config.Prepare, uniqueSuffix, Artifact, IP filtering)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2
- Forks
- 1
- Avg merge
- 3h 9m
- Merged PRs (30d)
- 3
Description
Problem
Every test in the repo is an acceptance test gated behind PACKER_ACC=1 plus a live Oxide silo, so go test ./... / make test currently exercises nothing. Pure, trivially testable logic has zero coverage:
Config.Prepare— defaults (name, hostname, CPUs, memory, boot disk size, VPC, subnet), required-field validation,user_datasize limit, warning/error shapes.uniqueSuffix()— build-name sanitization (_→-, charset filtering, trimming),PACKER_RUN_UUIDtruncation to 8 chars.Artifact—Id(),String(),State()including the HCP Packer registry image output (registryimage.FromArtifactwiring).- External IP filtering in
stepInstanceExternalIPList(ephemeral vs floating vs SNAT). - Data source
Configurevalidation.
A table-driven unit test of stepImageCreate with a canned state bag would have caught the -force panic (oxidecomputer/packer-plugin-oxide#101).
Fix
Add conventional _test.go unit tests for the above. Steps that need the Oxide API are covered by a separate issue about abstracting the client.
Contributor guide
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 go test ./... or make test, then locate Config.Prepare, uniqueSuffix(), Artifact, stepInstanceExternalIPList, data source Configure, and stepImageCreate. Add conventional _test.go coverage for the listed defaults, validation, formatting, filtering, and the canned state-bag case; keep API-dependent steps to the separate abstraction issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100