(t *testing.T)
| 1281 | } |
| 1282 | |
| 1283 | func TestCollectionStatsClose(t *testing.T) { |
| 1284 | m, _ := NewCollection(CollectionOptions{}) |
| 1285 | m.Start() |
| 1286 | |
| 1287 | b, err := m.NewBatch(0, 0) |
| 1288 | if err != nil { |
| 1289 | t.Errorf("expected ok") |
| 1290 | } |
| 1291 | |
| 1292 | b.Set([]byte("a"), []byte("A")) |
| 1293 | |
| 1294 | err = m.ExecuteBatch(b, WriteOptions{}) |
| 1295 | if err != nil { |
| 1296 | t.Errorf("expected exec batch ok") |
| 1297 | } |
| 1298 | |
| 1299 | s, err := m.Stats() |
| 1300 | if err != nil || s == nil { |
| 1301 | t.Errorf("expect some stats") |
| 1302 | } |
| 1303 | |
| 1304 | if s.CurDirtyBytes <= 0 { |
| 1305 | t.Errorf("expected dirty bytes, %#v", s) |
| 1306 | } |
| 1307 | |
| 1308 | if s.CurDirtySegments <= 0 { |
| 1309 | t.Errorf("expected dirty segments, %#v", s) |
| 1310 | } |
| 1311 | |
| 1312 | m.Close() |
| 1313 | |
| 1314 | s, err = m.Stats() |
| 1315 | if err != nil || s == nil { |
| 1316 | t.Errorf("expect some stats") |
| 1317 | } |
| 1318 | |
| 1319 | if s.CurDirtyBytes > 0 { |
| 1320 | t.Errorf("expected no dirty bytes after close, %#v", s) |
| 1321 | } |
| 1322 | |
| 1323 | if s.CurDirtySegments > 0 { |
| 1324 | t.Errorf("expected no dirty segments after close, %#v", s) |
| 1325 | } |
| 1326 | } |
| 1327 | |
| 1328 | func TestCollectionGet(t *testing.T) { |
| 1329 | m, _ := NewCollection(CollectionOptions{}) |
nothing calls this directly
no test coverage detected
searching dependent graphs…