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

Method RequireCurrentVersion

db/util_testing.go:837–849  ·  view source on GitHub ↗

requireCurrentVersion fetches the document by key, and validates that cv matches.

(t *testing.T, key string, source string, version uint64)

Source from the content-addressed store, hash-verified

835
836// requireCurrentVersion fetches the document by key, and validates that cv matches.
837func (c *DatabaseCollection) RequireCurrentVersion(t *testing.T, key string, source string, version uint64) {
838 ctx := base.TestCtx(t)
839 doc, err := c.GetDocument(ctx, key, DocUnmarshalSync)
840 require.NoError(t, err)
841 if doc.HLV == nil {
842 require.Equal(t, "", source)
843 require.Equal(t, "", version)
844 return
845 }
846
847 require.Equal(t, doc.HLV.SourceID, source)
848 require.Equal(t, doc.HLV.Version, version)
849}
850
851// GetDocumentCurrentVersion fetches the document by key and returns the current version
852func (c *DatabaseCollection) GetDocumentCurrentVersion(t testing.TB, key string) (source string, version uint64) {

Callers 2

TestChannelViewFunction · 0.80
TestChannelQueryFunction · 0.80

Calls 3

GetDocumentMethod · 0.95
TestCtxFunction · 0.92
EqualMethod · 0.45

Tested by 2

TestChannelViewFunction · 0.64
TestChannelQueryFunction · 0.64