oxidecomputer / oxidecomputer/packer-plugin-oxide
Make builder steps unit-testable by abstracting the Oxide client
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2
- Forks
- 1
- Avg merge
- 3h 9m
- Merged PRs (30d)
- 3
Description
Problem
All builder steps pull the concrete *oxide.Client out of the state bag and call it directly, so step Run/Cleanup logic (wait loops, timeout handling, cleanup ordering, -force deletion, error propagation) can only be exercised against a live Oxide silo.
Fix
Two viable approaches:
- Define a narrow interface covering the ~10 client methods the steps actually use (
InstanceCreate,InstanceView,InstanceStop,InstanceDelete,DiskDelete,SnapshotCreate,SnapshotDelete,ImageView,ImageCreate,ImageDelete,InstanceExternalIpList,CurrentUserSshKeyCreate,CurrentUserSshKeyDelete) and store that in the state bag instead of the concrete client. Steps get tested with a fake. - Alternatively, point the real client at an
httptest.Serverwith canned responses.
Option 1 is less brittle to SDK changes. Unblocks step-level unit tests for the wait/timeout/cleanup paths that acceptance tests can't reliably reach.
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 by locating the builder steps that pull *oxide.Client from the state bag and catalog the listed client methods they use. Choose between a narrow fakeable interface and an httptest.Server, then verify that Run and Cleanup wait, timeout, cleanup-ordering, force-deletion, and error-propagation paths can be exercised without a live silo.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devtools
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100