MCPcopy
hub / github.com/garethgeorge/backrest / tryExpectExactOperations

Function tryExpectExactOperations

internal/api/syncapi/syncapi_test.go:554–570  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context, peer *peerUnderTest, query oplog.Query, wantOps []*v1.Operation, message string)

Source from the content-addressed store, hash-verified

552}
553
554func 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
572func tryExpectOperationsSynced(t *testing.T, ctx context.Context, peer1 *peerUnderTest, peer2 *peerUnderTest, query oplog.Query, message string) {
573 err := testutil.Retry(t, ctx, func() error {

Callers 2

TestSimpleOperationSyncFunction · 0.85
TestSyncMutationsFunction · 0.85

Calls 3

RetryFunction · 0.92
getOperationsFunction · 0.70
TransformMethod · 0.65

Tested by

no test coverage detected