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

Function TestCodeSQLReadOnlyDisablesLiveWatcher

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

Source from the content-addressed store, hash-verified

167}
168
169func TestCodeSQLReadOnlyDisablesLiveWatcher(t *testing.T) {
170 source := t.TempDir()
171 writeTestFile(t, filepath.Join(source, "main.go"), `package main
172
173func Handler() {}
174`)
175
176 conf := &Config{
177 Core: Core{
178 DisableAllowList: true,
179 Sources: []core.SourceConfig{
180 {Name: "code", Kind: "code", Path: source, ReadOnly: true},
181 },
182 },
183 Serv: Serv{
184 Production: true,
185 ConfigPath: filepath.Join(t.TempDir(), "config"),
186 MCP: MCPConfig{Disable: true},
187 },
188 }
189
190 s, err := newGraphJinService(conf, nil)
191 if err != nil {
192 t.Fatal(err)
193 }
194 defer closeTestService(s)
195
196 assertServiceCount(t, s, "code", `SELECT count(*) FROM gj_code WHERE kind = 'symbol' AND name = 'Handler'`, 1)
197 if managed := s.managedDBs["code"]; managed.watch {
198 t.Fatalf("codesql watcher enabled for read-only database, want disabled")
199 }
200}
201
202func TestCodeSQLReadOnlyBlocksSourceMutation(t *testing.T) {
203 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