Move construction and document OnOutbox out of server, give HTTP/CLI a shared task use case, and block already-cleared import/event arch rules. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package archtest
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestArchitectureBoundaries(t *testing.T) {
|
|
root, err := ModuleRoot()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
b, err := LoadBoundaries(DefaultBoundariesPath(root))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
findings, err := Scan(ScanOptions{Root: root}, b)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
ev := Evaluate(findings, b, time.Now())
|
|
if os.Getenv("ARCHTEST_DUMP") != "" {
|
|
t.Log(ev.Report())
|
|
}
|
|
if ev.Failed() {
|
|
t.Fatal(ev.Report())
|
|
}
|
|
if os.Getenv("ARCHTEST_STRICT") == "" {
|
|
return
|
|
}
|
|
if len(b.BlockKinds) == 0 {
|
|
if len(ev.Excepted) > 0 {
|
|
t.Fatalf("strict/block mode: %d baseline exceptions remain\n%s", len(ev.Excepted), ev.Report())
|
|
}
|
|
return
|
|
}
|
|
for _, f := range ev.Excepted {
|
|
for _, kind := range b.BlockKinds {
|
|
if f.Kind == kind {
|
|
t.Fatalf("strict/block mode: cleared kind %s still has exception %s\n%s", kind, f.Key(), ev.Report())
|
|
}
|
|
}
|
|
}
|
|
for _, kind := range b.BlockKinds {
|
|
if ev.Counts[kind] > 0 {
|
|
t.Fatalf("strict/block mode: cleared kind %s count=%d\n%s", kind, ev.Counts[kind], ev.Report())
|
|
}
|
|
}
|
|
}
|