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

Function TestDocChannelSetPruning

rest/api_test.go:2799–2820  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2797}
2798
2799func TestDocChannelSetPruning(t *testing.T) {
2800 defer db.SuspendSequenceBatching()()
2801 rt := NewRestTester(t, &RestTesterConfig{SyncFn: channels.DocChannelsSyncFunction})
2802 defer rt.Close()
2803
2804 const docID = "doc"
2805 version := rt.PutDoc(docID, `{"channels": ["a"]}`)
2806
2807 for i := 0; i < 10; i++ {
2808 version = rt.UpdateDoc(docID, version, `{"channels": []}`)
2809 version = rt.UpdateDoc(docID, version, `{"channels": ["a"]}`)
2810 }
2811
2812 collection, ctx := rt.GetSingleTestDatabaseCollection()
2813 syncData, err := collection.GetDocSyncData(ctx, "doc")
2814 assert.NoError(t, err)
2815
2816 require.Len(t, syncData.ChannelSetHistory, db.DocumentHistoryMaxEntriesPerChannel)
2817 assert.Equal(t, "a", syncData.ChannelSetHistory[0].Name)
2818 assert.Equal(t, uint64(1), syncData.ChannelSetHistory[0].Start)
2819 assert.Equal(t, uint64(12), syncData.ChannelSetHistory[0].End)
2820}
2821
2822func TestRejectWritesWhenInBroadcastSlowMode(t *testing.T) {
2823 if !base.TestUseXattrs() {

Callers

nothing calls this directly

Calls 9

CloseMethod · 0.95
PutDocMethod · 0.95
UpdateDocMethod · 0.95
SuspendSequenceBatchingFunction · 0.92
NewRestTesterFunction · 0.85
GetDocSyncDataMethod · 0.80
LenMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected