---
id: w2/m7/t009
title: Test coverage — core verbs, adapters, connection-info, suspend/resume
worker: worker2
status: done
estimate: 45m
depends_on: [w2/m7/t007]
---

## Objective

Meaningful tests for what m7 shipped, modeled on `internal/postgres/postgres_test.go`: core CRUD against a fake/envtest client, connection-info correctness (password only there; external string gated on `public`), Render-shaped REST payloads + error shapes, GraphQL resolver paths, MCP tool round-trips, and the operator's suspend/resume envtest (replicas 0 ↔ N, Secret stable). Real behavior and failure modes — no tautologies.

## Context

- Failure cases that matter: unknown id/name (404 shape), create with invalid plan (Render 400), connection-info before Ready, suspend of an already-suspended store, resume restoring the same password.

## Steps

1. Backend: table tests per surface; share fixtures with the postgres tests where sensible.
2. Operator: extend `keyvalue_test.go` envtest with the suspend/resume case.
3. `cd lego/backend && go test ./...` + `make test` (operator) green.

## Files

- `lego/backend/internal/keyvalue/*_test.go`
- `lego/operator/internal/controller/keyvalue_test.go`

## Acceptance criteria

- [ ] Each surface's happy path + the failure modes above asserted.
- [ ] Suspend/resume envtest passes; both suites green.

## Out of scope

- Dashboard tests (w5/m12); e2e against prod.
