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

Function TestKnownRevsForCheckChangeVersion

db/crud_test.go:1498–1522  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1496}
1497
1498func TestKnownRevsForCheckChangeVersion(t *testing.T) {
1499
1500 db, ctx := setupTestDB(t)
1501 defer db.Close(ctx)
1502 collection, ctx := GetSingleDatabaseCollectionWithUser(ctx, t, db)
1503
1504 // have three revisions on db for the doc
1505 revID, doc, err := collection.Put(ctx, t.Name(), Body{"some": "data"})
1506 require.NoError(t, err)
1507 for i := 0; i < 2; i++ {
1508 revID, doc, err = collection.Put(ctx, t.Name(), Body{"some": "data", BodyRev: revID})
1509 require.NoError(t, err)
1510 }
1511
1512 // call CheckChangeVersion with fake VV and the docID from above
1513 missing, possible := collection.CheckChangeVersion(ctx, t.Name(), "123@src")
1514
1515 // assert that the missing revision is the CV and known revID is current revIDS of the document
1516 require.Len(t, missing, 1)
1517 require.Len(t, possible, 2)
1518 // db's CV and revID of the doc should be returned as known revs by CheckChangeVersion
1519 assert.Equal(t, "123@src", missing[0])
1520 assert.Equal(t, doc.HLV.GetCurrentVersionString(), possible[0])
1521 assert.Equal(t, doc.GetRevTreeID(), possible[1])
1522}
1523
1524func TestPutStampClusterUUID(t *testing.T) {
1525 if base.UnitTestUrlIsWalrus() || !base.TestUseXattrs() {

Callers

nothing calls this directly

Calls 10

setupTestDBFunction · 0.85
CheckChangeVersionMethod · 0.80
CloseMethod · 0.65
PutMethod · 0.65
NameMethod · 0.65
LenMethod · 0.65
EqualMethod · 0.45
GetRevTreeIDMethod · 0.45

Tested by

no test coverage detected