Add a live-platform integration test for the app lifecycle #2

Merged
geusebio merged 1 commit from feature/integration-test into main 2026-08-20 18:25:27 +00:00
Owner

The acceptance tests (acc_test.go) drive OpenTofu through the provider against an in-memory /cli stub — which can only ever agree with itself. This adds the same round-trip against a real, seeded someones.computer, so we catch drift in the actual wire contract.

What

internal/provider/integration_test.goTestIntegrationApplicationLifecycle:

  • terraform apply an application + a variable
  • read both back over the wire with a bare scclient (not just from Terraform state)
  • change the variable value → assert the version bump on the platform, not only in state
  • import the application by slug (ImportStateVerify)
  • CheckDestroy confirms an explained 404 after destroy

This is the declarative half of "deploy an app": the provider owns the application, its variables and bindings — not the running revision (immutable revisions come from sc deploy), so the test stops at provisioning.

Gating & safety

  • Skips unless SC_INTEGRATION=1 and SC_ENDPOINT+SC_TOKEN are set (the plugin-testing TF_ACC gate applies on top). So go test ./... and the coverage gate stay hermetic — verified they still skip and coverage is unchanged at 72.8%.
  • Per-run unique slug (tf-int-<base36 nanos>) so parallel or shared-swarm stacks never collide and a crashed run never wedges the next.
  • Multi-org accounts set SC_INTEGRATION_ORG; a single-org account (the dev seed) leaves it unset.
  • make testint runs it.

Verified

go vet, golangci-lint (0 issues), clean skips with and without TF_ACC, coverage 72.8%. Not yet run against a live platform — the dedicated dev-seeded CI job that does that is a follow-up in the platform repo.

The acceptance tests (`acc_test.go`) drive OpenTofu through the provider against an in-memory `/cli` stub — which can only ever agree with itself. This adds the same round-trip against a **real, seeded** someones.computer, so we catch drift in the actual wire contract. ## What `internal/provider/integration_test.go` — `TestIntegrationApplicationLifecycle`: - `terraform apply` an application + a variable - read both back **over the wire** with a bare scclient (not just from Terraform state) - change the variable value → assert the version bump on the **platform**, not only in state - import the application by slug (`ImportStateVerify`) - `CheckDestroy` confirms an explained 404 after destroy This is the declarative half of "deploy an app": the provider owns the application, its variables and bindings — not the running revision (immutable revisions come from `sc deploy`), so the test stops at provisioning. ## Gating & safety - Skips unless `SC_INTEGRATION=1` **and** `SC_ENDPOINT`+`SC_TOKEN` are set (the plugin-testing `TF_ACC` gate applies on top). So `go test ./...` and the coverage gate stay hermetic — verified they still skip and coverage is unchanged at **72.8%**. - Per-run unique slug (`tf-int-<base36 nanos>`) so parallel or shared-swarm stacks never collide and a crashed run never wedges the next. - Multi-org accounts set `SC_INTEGRATION_ORG`; a single-org account (the dev seed) leaves it unset. - `make testint` runs it. ## Verified `go vet`, `golangci-lint` (0 issues), clean skips with and without `TF_ACC`, coverage 72.8%. **Not yet run against a live platform** — the dedicated dev-seeded CI job that does that is a follow-up in the platform repo.
The acceptance tests drive OpenTofu through the provider against an in-memory
/cli stub, which can only ever agree with itself. This adds the same round-trip
against a real, seeded someones.computer: apply an application + a variable, read
them back over the wire with a bare scclient, change the value (asserting the
version bump on the platform, not just in state), import by slug, and confirm an
explained 404 after destroy.

- internal/provider/integration_test.go: TestIntegrationApplicationLifecycle,
  gated behind SC_INTEGRATION + SC_ENDPOINT/SC_TOKEN (the plugin-testing TF_ACC
  gate on top of that), so `go test ./...` and the coverage gate stay hermetic.
  Per-run unique slug so shared-swarm/parallel stacks never collide.
- GNUmakefile: `make testint`.

The declarative half of "deploy an app" — the provider owns the application,
variables and bindings, not the running revision. Verified: vet, golangci-lint,
and clean skips with and without TF_ACC; coverage unchanged at 72.8%.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grey.ooo/someones.computer_terraform!2
No description provided.