gates / gates (push) Successful in 2m3s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"go/ast"
|
|
"go/parser"
|
|
"go/token"
|
|
"testing"
|
|
)
|
|
|
|
// R-600 seam wiring: main() must hand the WG reconciler's Trigger to the web server, or the customer
|
|
// delete cascade's immediate peer push is dead code and the deleted box's peer lingers on the endpoint
|
|
// until the next 5-minute tick. RED-PROOF: delete the SetWGPeerSync call → this test fails.
|
|
func TestR600_MainWiresWGPeerSyncIntoWeb(t *testing.T) {
|
|
f, err := parser.ParseFile(token.NewFileSet(), "main.go", nil, 0)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
wired := false
|
|
ast.Inspect(f, func(n ast.Node) bool {
|
|
c, ok := n.(*ast.CallExpr)
|
|
if !ok {
|
|
return true
|
|
}
|
|
if sel, ok := c.Fun.(*ast.SelectorExpr); ok && sel.Sel.Name == "SetWGPeerSync" && len(c.Args) == 1 {
|
|
if arg, ok := c.Args[0].(*ast.SelectorExpr); ok && arg.Sel.Name == "Trigger" {
|
|
wired = true
|
|
}
|
|
}
|
|
return true
|
|
})
|
|
if !wired {
|
|
t.Error("cmd/hub/main.go never calls webServer.SetWGPeerSync(<reconciler>.Trigger) — the delete cascade cannot push the peer removal")
|
|
}
|
|
}
|