| 183 | } |
| 184 | |
| 185 | func TestQueryLoggerStopIsIdempotent(t *testing.T) { |
| 186 | db, err := sql.Open("duckdb", ":memory:") |
| 187 | if err != nil { |
| 188 | t.Fatalf("open duckdb: %v", err) |
| 189 | } |
| 190 | |
| 191 | ql := &QueryLogger{ |
| 192 | db: db, |
| 193 | cfg: QueryLogConfig{ |
| 194 | BatchSize: 1, |
| 195 | FlushInterval: time.Hour, |
| 196 | }, |
| 197 | ch: make(chan QueryLogEntry, 1), |
| 198 | done: make(chan struct{}), |
| 199 | } |
| 200 | |
| 201 | go ql.flushLoop() |
| 202 | |
| 203 | ql.Stop() |
| 204 | ql.Stop() |
| 205 | } |
| 206 | |
| 207 | func TestHighBitHashInsertIntoBigint(t *testing.T) { |
| 208 | db, err := sql.Open("duckdb", ":memory:") |
| 209 | if err != nil { |
| 210 | t.Fatalf("open duckdb: %v", err) |
| 211 | } |
| 212 | defer func() { _ = db.Close() }() |
| 213 | |
| 214 | _, err = db.Exec("CREATE TABLE test_hash (h BIGINT)") |
| 215 | if err != nil { |
| 216 | t.Fatalf("create table: %v", err) |
| 217 | } |