MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestPeerImplementation

Function TestPeerImplementation

topologytest/peer_test.go:462–604  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

460}
461
462func 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()

Callers

nothing calls this directly

Calls 15

MustJSONMarshalFunction · 0.92
createPeersFunction · 0.85
getSingleDsNameFunction · 0.85
RunMethod · 0.65
TypeMethod · 0.65
CreateReplicationMethod · 0.65
StartMethod · 0.65
StopMethod · 0.65
NameMethod · 0.65
CreateDocumentMethod · 0.65
WaitForDocVersionMethod · 0.65
GetDocumentMethod · 0.65

Tested by

no test coverage detected