(t *testing.T)
| 652 | } |
| 653 | |
| 654 | func 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 | |
| 702 | func TestTreeNodeFromSourceWithGlob(t *testing.T) { |
| 703 |
nothing calls this directly
no test coverage detected
searching dependent graphs…