MCPcopy
hub / github.com/dosco/graphjin / TestCodeSQLProductionDisablesLiveWatcherByDefault

Function TestCodeSQLProductionDisablesLiveWatcherByDefault

serv/codesql_test.go:103–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestCodeSQLProductionDisablesLiveWatcherByDefault(t *testing.T) {
104 source := t.TempDir()
105 writeTestFile(t, filepath.Join(source, "main.go"), `package main
106
107func Handler() {}
108`)
109
110 conf := &Config{
111 Core: Core{
112 DisableAllowList: true,
113 Sources: []core.SourceConfig{
114 {Name: "code", Kind: "code", Path: source},
115 },
116 },
117 Serv: Serv{
118 Production: true,
119 ConfigPath: filepath.Join(t.TempDir(), "config"),
120 MCP: MCPConfig{Disable: true},
121 },
122 }
123
124 s, err := newGraphJinService(conf, nil)
125 if err != nil {
126 t.Fatal(err)
127 }
128 defer closeTestService(s)
129
130 assertServiceCount(t, s, "code", `SELECT count(*) FROM gj_code WHERE kind = 'symbol' AND name = 'Handler'`, 1)
131 if managed := s.managedDBs["code"]; managed.watch {
132 t.Fatalf("codesql watcher enabled in production by default, want disabled")
133 }
134}
135
136func TestCodeSQLProductionEnablesLiveWatcherWithCapability(t *testing.T) {
137 source := t.TempDir()

Callers

nothing calls this directly

Calls 4

writeTestFileFunction · 0.85
newGraphJinServiceFunction · 0.85
closeTestServiceFunction · 0.85
assertServiceCountFunction · 0.85

Tested by

no test coverage detected