Skip to content

Commit beafea8

Browse files
authored
CBG-4798: add test for revID replicator write HLV generation (#7674)
1 parent 21885c9 commit beafea8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

rest/api_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3222,3 +3222,25 @@ func TestSilentHandlerLoggingInTrace(t *testing.T) {
32223222
RequireStatus(t, resp, http.StatusOK)
32233223
})
32243224
}
3225+
3226+
// TestHLVUpdateOnRevReplicatorPut:
3227+
// - Test that the HLV is updated correctly when a document is put via the rev replicator running in rev mode
3228+
func TestHLVUpdateOnRevReplicatorPut(t *testing.T) {
3229+
3230+
rt := NewRestTester(t, nil)
3231+
defer rt.Close()
3232+
3233+
docID := t.Name()
3234+
newVersion := DocVersion{
3235+
RevTreeID: "1-abc",
3236+
}
3237+
_ = rt.PutNewEditsFalse(docID, newVersion, EmptyDocVersion(), `{"some":"body"}`)
3238+
3239+
collection, ctx := rt.GetSingleTestDatabaseCollection()
3240+
syncData, err := collection.GetDocSyncData(ctx, docID)
3241+
require.NoError(t, err)
3242+
3243+
assert.Equal(t, rt.GetDatabase().EncodedSourceID, syncData.HLV.SourceID)
3244+
assert.Equal(t, base.HexCasToUint64(syncData.Cas), syncData.HLV.Version)
3245+
assert.Equal(t, base.HexCasToUint64(syncData.Cas), syncData.HLV.CurrentVersionCAS)
3246+
}

0 commit comments

Comments
 (0)