(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestCodeSQLProductionDisablesLiveWatcherByDefault(t *testing.T) { |
| 104 | source := t.TempDir() |
| 105 | writeTestFile(t, filepath.Join(source, "main.go"), `package main |
| 106 | |
| 107 | func 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 | |
| 136 | func TestCodeSQLProductionEnablesLiveWatcherWithCapability(t *testing.T) { |
| 137 | source := t.TempDir() |
nothing calls this directly
no test coverage detected