generated from mathias/template-go-web
feat(atlas): Phase C — live Flux reconcile status on stage 07
Stage 07 now also shows the Flux `apps` Kustomization state — reconciled/failed + last-applied revision (main@shortsha) — read in-cluster (new read-only Role in flux-system). Sits alongside the live deploy node. FluxStatus/FluxNode test-first, fallback-safe. Verified: build/vet/lint(0)/test green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,34 @@ func TestNamespaceSummary_CapsWithMore(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFluxStatus_ParsesReadyReasonAndShortRevision(t *testing.T) {
|
||||
k := []byte(`{"status":{
|
||||
"conditions":[{"type":"Ready","status":"True","reason":"ReconciliationSucceeded","message":"Applied revision: main@sha1:7a51d1d13944"}],
|
||||
"lastAppliedRevision":"main@sha1:7a51d1d13944c481b04fc434d9a2aca2a25632e4"}}`)
|
||||
|
||||
f, err := atlas.FluxStatus(k)
|
||||
if err != nil {
|
||||
t.Fatalf("FluxStatus: %v", err)
|
||||
}
|
||||
if !f.Ready || f.Reason != "ReconciliationSucceeded" || f.Revision != "main@7a51d1d" {
|
||||
t.Fatalf("flux = %+v", f)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFluxNode_GreenWhenReadyCoralWhenNot(t *testing.T) {
|
||||
ready := atlas.FluxNode(atlas.Flux{Ready: true, Reason: "ReconciliationSucceeded", Revision: "main@7a51d1d"})
|
||||
if ready.Pill != "var(--green)" {
|
||||
t.Fatalf("ready pill = %q", ready.Pill)
|
||||
}
|
||||
if ready.Title != "⟳ Flux · reconciled · main@7a51d1d" {
|
||||
t.Fatalf("title = %q", ready.Title)
|
||||
}
|
||||
notReady := atlas.FluxNode(atlas.Flux{Ready: false, Reason: "BuildFailed"})
|
||||
if notReady.Pill != "var(--coral)" {
|
||||
t.Fatalf("not-ready pill = %q", notReady.Pill)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeployState_ParsesImageAndReplicas(t *testing.T) {
|
||||
dep := []byte(`{"spec":{"replicas":2,"template":{"spec":{"containers":[
|
||||
{"name":"cad-atlas","image":"localhost:5000/cad-atlas:3ff922a"}]}}},
|
||||
|
||||
Reference in New Issue
Block a user