MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestBlipStatsBasic

Function TestBlipStatsBasic

rest/blip_stats_test.go:36–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestBlipStatsBasic(t *testing.T) {
37 bt := NewBlipTester(t)
38 defer bt.Close()
39
40 // make sure requests have not incremented stats.
41 /// Note: there is a blip call in NewBlipTester to initialize collections
42 dbStats := bt.restTester.GetDatabase().DbStats.Database()
43 require.Equal(t, int64(0), dbStats.ReplicationBytesReceived.Value())
44 require.Equal(t, int64(0), dbStats.ReplicationBytesSent.Value())
45
46 // send a request, close BlipSyncContext and make sure stats are incremented
47 sendGetCheckpointRequest(bt)
48
49 // requests shouldn't be implemented as part of handler
50 require.Equal(t, int64(0), dbStats.ReplicationBytesReceived.Value())
51 require.Equal(t, int64(0), dbStats.ReplicationBytesSent.Value())
52
53 bt.sender.Close()
54
55 waitForStatGreaterThan(t, dbStats.ReplicationBytesReceived.Value, 1)
56 waitForStatGreaterThan(t, dbStats.ReplicationBytesSent.Value, 1)
57
58}
59
60func TestBlipStatsFastReport(t *testing.T) {
61 bt := NewBlipTester(t)

Callers

nothing calls this directly

Calls 9

CloseMethod · 0.95
NewBlipTesterFunction · 0.85
sendGetCheckpointRequestFunction · 0.85
waitForStatGreaterThanFunction · 0.85
CloseMethod · 0.65
DatabaseMethod · 0.45
GetDatabaseMethod · 0.45
EqualMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected