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

Function TestCollectionStats

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

Source from the content-addressed store, hash-verified

1250}
1251
1252func TestCollectionStats(t *testing.T) {
1253 cs0 := &CollectionStats{}
1254 cs1 := &CollectionStats{}
1255 cs0.AtomicCopyTo(cs1)
1256 if !reflect.DeepEqual(cs0, cs1) {
1257 t.Errorf("expect empty compare to equal")
1258 }
1259 cs0.TotOnError = 1234
1260 cs0.AtomicCopyTo(cs1)
1261 if !reflect.DeepEqual(cs0, cs1) {
1262 t.Errorf("expect empty compare to equal")
1263 }
1264
1265 m, _ := NewCollection(CollectionOptions{})
1266 m.Start()
1267 m.Close()
1268
1269 s, err := m.Stats()
1270 if err != nil || s == nil {
1271 t.Errorf("expect some stats")
1272 }
1273
1274 if reflect.DeepEqual(s, &CollectionStats{}) {
1275 t.Errorf("expect nonzero stats")
1276 }
1277
1278 if s.TotCloseBeg != 1 || s.TotCloseEnd != 1 {
1279 t.Errorf("expect close stat == 1")
1280 }
1281}
1282
1283func TestCollectionStatsClose(t *testing.T) {
1284 m, _ := NewCollection(CollectionOptions{})

Callers

nothing calls this directly

Calls 5

AtomicCopyToMethod · 0.95
StartMethod · 0.95
CloseMethod · 0.95
StatsMethod · 0.95
NewCollectionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…