Files
Agent-System/internal/events/cutover_script_test.go
T
weichenandCursor 4a662ec2d3 feat(events): gate shared-dev consumer mode changes
Add ValidateOpsCutover, eventmode CLI, and a host script that pin agent_system_dev and refuse FAV plus test/main before any cluster mode write.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 14:11:44 +00:00

45 lines
975 B
Go

package events_test
import (
"os"
"path/filepath"
"strings"
"testing"
)
func TestEventConsumerModeScriptGates(t *testing.T) {
root := repoRoot(t)
text, err := os.ReadFile(filepath.Join(root, "scripts", "event-consumer-mode.sh"))
if err != nil {
t.Fatal(err)
}
s := string(text)
if !strings.Contains(s, "fav") || !strings.Contains(s, "refusing test/main") {
t.Fatal("script must reject fav and test/main")
}
if strings.Contains(s, "5434") || strings.Contains(s, "5435") {
t.Fatal("script must not pin test/main ports")
}
if !strings.Contains(s, "agent_system_dev") || !strings.Contains(s, "5433") {
t.Fatal("script must pin shared dev db")
}
}
func repoRoot(t *testing.T) string {
t.Helper()
dir, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
for {
if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil {
return dir
}
parent := filepath.Dir(dir)
if parent == dir {
t.Fatal("go.mod not found")
}
dir = parent
}
}