557629d2bf
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
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"go/ast"
|
|
"go/parser"
|
|
"go/token"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// R-855: the start log line naming the Docker approval nights must print the EFFECTIVE count
|
|
// (osSvc.DockerNightsEffective()), not the raw field, whose TEST "none" value is -1 and printed
|
|
// "after -1 healthy ring-0 night(s)". RED-PROOF: pass osSvc.DockerNights → this test fails.
|
|
func TestR855_StartLogPrintsEffectiveDockerNights(t *testing.T) {
|
|
f, err := parser.ParseFile(token.NewFileSet(), "main.go", nil, 0)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
found, effective := false, false
|
|
ast.Inspect(f, func(n ast.Node) bool {
|
|
c, ok := n.(*ast.CallExpr)
|
|
if !ok || len(c.Args) < 2 {
|
|
return true
|
|
}
|
|
lit, ok := c.Args[0].(*ast.BasicLit)
|
|
if !ok || !strings.Contains(lit.Value, "healthy ring-0 night(s)") {
|
|
return true
|
|
}
|
|
found = true
|
|
if call, ok := c.Args[1].(*ast.CallExpr); ok {
|
|
if sel, ok := call.Fun.(*ast.SelectorExpr); ok && sel.Sel.Name == "DockerNightsEffective" {
|
|
effective = true
|
|
}
|
|
}
|
|
return true
|
|
})
|
|
if !found {
|
|
t.Fatal("main.go no longer logs the Docker approval nights — update this test with the new line")
|
|
}
|
|
if !effective {
|
|
t.Error("the Docker approval-nights start log must print osSvc.DockerNightsEffective(), not the raw field")
|
|
}
|
|
}
|