(t *testing.T)
| 460 | } |
| 461 | |
| 462 | func TestPeerImplementation(t *testing.T) { |
| 463 | testCases := []struct { |
| 464 | name string |
| 465 | peerOption PeerOptions |
| 466 | }{ |
| 467 | { |
| 468 | name: "cbs", |
| 469 | peerOption: PeerOptions{ |
| 470 | Type: PeerTypeCouchbaseServer, |
| 471 | BucketID: PeerBucketID1, |
| 472 | }, |
| 473 | }, |
| 474 | { |
| 475 | name: "sg", |
| 476 | peerOption: PeerOptions{ |
| 477 | Type: PeerTypeSyncGateway, |
| 478 | BucketID: PeerBucketID1, |
| 479 | }, |
| 480 | }, |
| 481 | { |
| 482 | name: "cbl", |
| 483 | peerOption: PeerOptions{ |
| 484 | Type: PeerTypeCouchbaseLite, |
| 485 | }, |
| 486 | }, |
| 487 | } |
| 488 | for _, tc := range testCases { |
| 489 | t.Run(tc.name, func(t *testing.T) { |
| 490 | opts := map[string]PeerOptions{tc.name: tc.peerOption} |
| 491 | // couchbase lite peer can't exist separately from sync gateway peer, CBG-4433 |
| 492 | if tc.peerOption.Type == PeerTypeCouchbaseLite { |
| 493 | opts["sg"] = PeerOptions{Type: PeerTypeSyncGateway, BucketID: PeerBucketID1} |
| 494 | } |
| 495 | peers := createPeers(t, opts) |
| 496 | peer := peers[tc.name] |
| 497 | var replications Replications |
| 498 | // couchbase lite peer can't exist separately from sync gateway peer, CBG-4433 |
| 499 | if peer.Type() == PeerTypeCouchbaseLite { |
| 500 | pullReplication := peer.CreateReplication(peers["sg"], PeerReplicationConfig{ |
| 501 | direction: PeerReplicationDirectionPull, |
| 502 | }) |
| 503 | pullReplication.Start() |
| 504 | defer pullReplication.Stop() |
| 505 | |
| 506 | replications = append(replications, pullReplication) |
| 507 | pushReplication := peer.CreateReplication(peers["sg"], PeerReplicationConfig{ |
| 508 | direction: PeerReplicationDirectionPush, |
| 509 | }) |
| 510 | pushReplication.Start() |
| 511 | defer pushReplication.Stop() |
| 512 | replications = append(replications, pushReplication) |
| 513 | } |
| 514 | topology := Topology{ |
| 515 | peers: peers, |
| 516 | replications: replications, |
| 517 | } |
| 518 | |
| 519 | docID := t.Name() |
nothing calls this directly
no test coverage detected