(t *testing.T)
| 167 | } |
| 168 | |
| 169 | func TestCodeSQLReadOnlyDisablesLiveWatcher(t *testing.T) { |
| 170 | source := t.TempDir() |
| 171 | writeTestFile(t, filepath.Join(source, "main.go"), `package main |
| 172 | |
| 173 | func 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 | |
| 202 | func TestCodeSQLReadOnlyBlocksSourceMutation(t *testing.T) { |
| 203 | source := t.TempDir() |
nothing calls this directly
no test coverage detected