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

Function TestRevsHistoryInfiniteLoop

db/revtree_test.go:939–961  ·  view source on GitHub ↗

Regression test for https://github.com/couchbase/sync_gateway/issues/2847

(t *testing.T)

Source from the content-addressed store, hash-verified

937
938// Regression test for https://github.com/couchbase/sync_gateway/issues/2847
939func TestRevsHistoryInfiniteLoop(t *testing.T) {
940
941 docId := "testdocProblematicRevTree"
942
943 rawDoc, err := unmarshalDocument(docId, []byte(testdocProblematicRevTree1))
944 if err != nil {
945 t.Fatalf("Error unmarshalling doc: %v", err)
946 }
947
948 revId := "275-6458b32429e335f981fc12b73765833d"
949 _, err = getHistoryWithTimeout(
950 rawDoc,
951 revId,
952 time.Second*1,
953 )
954
955 // This should return an error, since the history has cycles
956 assert.True(t, err != nil)
957
958 // The error should *not* be a timeout error
959 assert.False(t, strings.Contains(err.Error(), "Timeout"))
960
961}
962
963// Repair tool for https://github.com/couchbase/sync_gateway/issues/2847
964func TestRepairRevsHistoryWithCycles(t *testing.T) {

Callers

nothing calls this directly

Calls 5

unmarshalDocumentFunction · 0.85
getHistoryWithTimeoutFunction · 0.85
ContainsMethod · 0.65
FatalfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected