MCPcopy Create free account
hub / github.com/couchbase/moss / TestCollectionStatsClose

Function TestCollectionStatsClose

collection_test.go:1283–1326  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1281}
1282
1283func 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
1328func TestCollectionGet(t *testing.T) {
1329 m, _ := NewCollection(CollectionOptions{})

Callers

nothing calls this directly

Calls 7

StartMethod · 0.95
NewBatchMethod · 0.95
SetMethod · 0.95
ExecuteBatchMethod · 0.95
StatsMethod · 0.95
CloseMethod · 0.95
NewCollectionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…