MCPcopy Create free account
hub / github.com/pydio/cells / TestTreeDiffConflictsAndStatus

Function TestTreeDiffConflictsAndStatus

common/sync/merger/tree-diff_test.go:654–700  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

652}
653
654func TestTreeDiffConflictsAndStatus(t *testing.T) {
655
656 var left, right *memory.MemDB
657 Convey("", t, func() {
658 left = memory.NewMemDB()
659 right = memory.NewMemDB()
660
661 _ = right.CreateNode(testCtx, &tree.Node{
662 Path: "/aaa",
663 Type: tree.NodeType_COLLECTION,
664 Uuid: "uuid1",
665 Etag: "uuid1-hash",
666 }, true)
667 _ = left.CreateNode(testCtx, &tree.Node{
668 Path: "/aaa",
669 Type: tree.NodeType_COLLECTION,
670 Uuid: "uuid2",
671 Etag: "uuid2-hash",
672 }, true)
673
674 statusChan := make(chan model.Status, 1)
675 doneChan := make(chan interface{}, 1)
676
677 diff := newTreeDiff(left, right)
678 diff.SetupChannels(statusChan, doneChan, nil)
679
680 // start a routine to read status
681 f := func() {
682 for {
683 select {
684 case <-doneChan:
685 return
686 case s := <-statusChan:
687 t.Log(s)
688 }
689 }
690 }
691
692 go f()
693 e := diff.Compute(testCtx, "/", nil, nil)
694 So(e, ShouldBeNil)
695
696 go f()
697 _, _ = diff.leftAndRightPatches(testCtx, left, right)
698 So(diff.conflicts, ShouldHaveLength, 1)
699 })
700}
701
702func TestTreeNodeFromSourceWithGlob(t *testing.T) {
703

Callers

nothing calls this directly

Calls 9

CreateNodeMethod · 0.95
NewMemDBFunction · 0.92
makeFunction · 0.85
newTreeDiffFunction · 0.85
LogMethod · 0.80
leftAndRightPatchesMethod · 0.80
SetupChannelsMethod · 0.65
ComputeMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…