oxidecomputer / oxidecomputer/packer-plugin-oxide

Make builder steps unit-testable by abstracting the Oxide client

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

Nobody has claimed this yet.

Packer Plugin Testing
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:

  1. 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.
  2. Alternatively, point the real client at an httptest.Server with 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

Open the contributing guide

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.