| 298 | } |
| 299 | |
| 300 | func TestDB_Metrics(t *testing.T) { |
| 301 | tempDir := t.TempDir() |
| 302 | cfg := &config.Config{ |
| 303 | LevelDB: config.LevelDBConfig{ |
| 304 | CacheSize: 64 * 1024 * 1024, |
| 305 | BlockSize: 4 * 1024, |
| 306 | WriteBufferSize: 4 * 1024 * 1024, |
| 307 | MaxOpenFiles: 1000, |
| 308 | Compression: true, |
| 309 | }, |
| 310 | } |
| 311 | |
| 312 | dbInterface, err := Store{}.Open(tempDir, cfg) |
| 313 | require.NoError(t, err) |
| 314 | defer dbInterface.Close() |
| 315 | |
| 316 | // Type assert to access Metrics method |
| 317 | db, ok := dbInterface.(*DB) |
| 318 | require.True(t, ok, "Expected *DB type") |
| 319 | |
| 320 | title, metrics := db.Metrics() |
| 321 | |
| 322 | assert.Equal(t, "hybriddb", title) |
| 323 | assert.NotNil(t, metrics) |
| 324 | // Metrics might be empty if cache is disabled, so we don't check length |
| 325 | } |
| 326 | |
| 327 | func TestDB_ConcurrentAccess(t *testing.T) { |
| 328 | tempDir := t.TempDir() |