(t *testing.T, ctx context.Context, peer *peerUnderTest, query oplog.Query, wantOps []*v1.Operation, message string)
| 552 | } |
| 553 | |
| 554 | func tryExpectExactOperations(t *testing.T, ctx context.Context, peer *peerUnderTest, query oplog.Query, wantOps []*v1.Operation, message string) { |
| 555 | err := testutil.Retry(t, ctx, func() error { |
| 556 | ops := getOperations(t, peer.oplog, query) |
| 557 | for _, op := range ops { |
| 558 | op.Modno = 0 |
| 559 | } |
| 560 | if diff := cmp.Diff(ops, wantOps, protocmp.Transform()); diff != "" { |
| 561 | return fmt.Errorf("unexpected diff: %v", diff) |
| 562 | } |
| 563 | return nil |
| 564 | }) |
| 565 | if err != nil { |
| 566 | opsJson, _ := protojson.MarshalOptions{Indent: " "}.Marshal(&v1.OperationList{Operations: getOperations(t, peer.oplog, query)}) |
| 567 | t.Logf("found operations: %v", string(opsJson)) |
| 568 | t.Fatalf("%v: timeout without finding wanted operations: %v", message, err) |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | func tryExpectOperationsSynced(t *testing.T, ctx context.Context, peer1 *peerUnderTest, peer2 *peerUnderTest, query oplog.Query, message string) { |
| 573 | err := testutil.Retry(t, ctx, func() error { |
no test coverage detected