Files
spinifex/tests/e2e/bedrock/main_test.go
T
Josh Siviour cee73671ff feat(bedrock): Ochre runtime MVP — Converse over self-host + Anthropic-direct (#520)
* feat(bedrock): Ochre runtime MVP — Converse over self-host + Anthropic-direct

Add the AWS-Bedrock-compatible gateway services (bedrock, bedrock-runtime)
following the EKS REST-JSON pattern: ListFoundationModels / GetFoundationModel
over a static connectivity-tiered catalog, and non-streaming Converse routed
per modelId to one of two provider backends — self-hosted vLLM (OpenAI wire)
and Anthropic-direct (Anthropic Messages wire).

Per-account provider API keys are a master-key-encrypted JetStream KV secret
with an optional platform default; the advertised catalog gates external
models on a resolvable credential. Self-host endpoints are pinned via config
(OCHRE_VLLM_ENDPOINTS) behind an EndpointResolver seam.

Adds gateway/bedrock/ (catalog, provider router, Anthropic + vLLM adapters,
credential store), awserrors REST-JSON codes, and the bedrock E2E suite
(list/get light; Converse gated on live backends). Daemon/NATS control plane
and dynamic endpoint lifecycle are deferred to Phase 3.

* test(bedrock): cover dispatch, router, credentials KV + endpoint config

Add unit coverage for the Ochre Phase 1 diff: Bedrock_Request /
BedrockRuntime_Request end-to-end dispatch, provider router, JSON
response/error writers, upstream-status mapping, the credential-store KV
round-trip, the Anthropic bound-provider path, and parseBedrockEndpoints.
Lifts PR diff coverage above the 60% gate.
2026-07-13 21:40:34 +10:00

62 lines
1.6 KiB
Go

//go:build e2e
// Package bedrock is the Ochre (AWS-Bedrock) E2E suite. Hermetic API-shape and
// provider-translation parity (Anthropic Messages / vLLM OpenAI wire formats)
// is covered by the gateway_bedrock unit tests; this suite exercises
// ListFoundationModels/GetFoundationModel against any running cluster and
// gates real Converse calls on backend availability (self-host GPU or a live
// Anthropic key), so CI parity holds without requiring either to be present.
package bedrock
import (
"os"
"sync"
"testing"
"github.com/mulgadc/spinifex/tests/e2e/harness"
)
// Package-scoped singleton fixture, built lazily by requireBedrockFixture and
// torn down by TestMain after the run.
var (
pkgFixOnce sync.Once
pkgFix *Fixture
pkgFixErr error
)
// Fixture carries per-process state shared across every Test* in this package.
type Fixture struct {
Env *harness.Env
AWS *harness.AWSClient
Account string
}
func TestMain(m *testing.M) {
os.Exit(m.Run())
}
// requireBedrockFixture returns the package-scoped Fixture, building it on
// first call. Skips the calling test if SPINIFEX_E2E is unset.
func requireBedrockFixture(t *testing.T) *Fixture {
t.Helper()
pkgFixOnce.Do(func() {
if os.Getenv("SPINIFEX_E2E") == "" {
return
}
env := harness.LoadEnv(t)
awsCli := harness.NewAWSClient(t, env)
pkgFix = &Fixture{
Env: env,
AWS: awsCli,
Account: harness.IAMAccountID(t, awsCli),
}
})
if pkgFixErr != nil {
t.Fatalf("bedrock fixture init failed: %v", pkgFixErr)
}
if pkgFix == nil {
t.Skip("bedrock fixture unavailable (SPINIFEX_E2E unset)")
}
return pkgFix
}