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

Function TestRevTreeConflictCheck

db/database_test.go:4866–4977  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4864}
4865
4866func TestRevTreeConflictCheck(t *testing.T) {
4867 testCases := []struct {
4868 name string
4869 localHistory []string
4870 incomingHistory []string
4871 localDelete bool
4872 remoteDelete bool
4873 expectedConflict bool
4874 }{
4875 {
4876 name: "no conflict, simple update",
4877 localHistory: []string{"3-abc", "2-abc", "1-abc"},
4878 incomingHistory: []string{"4-abc", "3-abc", "2-abc", "1-abc"},
4879 localDelete: false,
4880 remoteDelete: false,
4881 expectedConflict: false,
4882 },
4883 {
4884 name: "diff in history",
4885 localHistory: []string{"3-abc", "2-abc", "1-abc"},
4886 incomingHistory: []string{"3-def", "2-def", "1-abc"},
4887 localDelete: false,
4888 remoteDelete: false,
4889 expectedConflict: true,
4890 },
4891 {
4892 name: "complete diff in history",
4893 localHistory: []string{"3-abc", "2-abc", "1-abc"},
4894 incomingHistory: []string{"3-def", "2-def", "1-def"},
4895 localDelete: false,
4896 remoteDelete: false,
4897 expectedConflict: true,
4898 },
4899 {
4900 name: "gap in history",
4901 localHistory: []string{"5-abc", "4-abc", "3-abc", "2-abc", "1-abc"},
4902 incomingHistory: []string{"10-abc", "9-abc"},
4903 localDelete: false,
4904 remoteDelete: false,
4905 expectedConflict: true,
4906 },
4907 {
4908 name: "incoming only has one entry in history, conflict 1",
4909 localHistory: []string{"3-abc", "2-abc", "1-abc"},
4910 incomingHistory: []string{"2-abc"},
4911 localDelete: false,
4912 remoteDelete: false,
4913 expectedConflict: true,
4914 },
4915 {
4916 name: "incoming only has one entry in history, conflict 2",
4917 localHistory: []string{"3-abc", "2-abc", "1-abc"},
4918 incomingHistory: []string{"2-def"},
4919 localDelete: false,
4920 remoteDelete: false,
4921 expectedConflict: true,
4922 },
4923 {

Callers

nothing calls this directly

Calls 11

setFlagMethod · 0.95
setupTestDBFunction · 0.85
NewDocumentFunction · 0.85
SetRevTreeIDMethod · 0.80
addRevisionMethod · 0.80
revTreeConflictCheckMethod · 0.80
CloseMethod · 0.65
RunMethod · 0.65
ContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected