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

Function TestIsCfgChanged

db/sg_replicate_cfg_test.go:547–669  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

545}
546
547func TestIsCfgChanged(t *testing.T) {
548
549 getInitialCfg := func() *ReplicationCfg {
550 return &ReplicationCfg{
551 ReplicationConfig: ReplicationConfig{
552 ID: "foo",
553 Remote: "a",
554 Direction: ActiveReplicatorTypePull,
555 ConflictResolutionType: ConflictResolverCustom,
556 ConflictResolutionFn: "a",
557 PurgeOnRemoval: true,
558 DeltaSyncEnabled: true,
559 MaxBackoff: 5,
560 InitialState: "a",
561 Continuous: true,
562 Filter: "a",
563 QueryParams: []interface{}{"ABC"},
564 Username: "alice",
565 Password: "password",
566 CollectionsLocal: []string{"foo.bar"},
567 },
568 }
569 }
570
571 type cfgChangedTest struct {
572 name string // Test name
573 updatedConfig *ReplicationUpsertConfig // Updated replication config
574 expectedChanged bool
575 }
576 testCases := []cfgChangedTest{
577 {
578 name: "remoteChanged",
579 updatedConfig: &ReplicationUpsertConfig{
580 Remote: base.Ptr("b"),
581 },
582 expectedChanged: true,
583 },
584 {
585 name: "directionChanged",
586 updatedConfig: &ReplicationUpsertConfig{
587 Direction: base.Ptr(string(ActiveReplicatorTypePushAndPull)),
588 },
589 expectedChanged: true,
590 },
591 {
592 name: "conflictResolverChanged",
593 updatedConfig: &ReplicationUpsertConfig{
594 ConflictResolutionType: base.Ptr(string(ConflictResolverDefault)),
595 },
596 expectedChanged: true,
597 },
598 {
599 name: "conflictResolverFnChange",
600 updatedConfig: &ReplicationUpsertConfig{
601 ConflictResolutionFn: base.Ptr("b"),
602 },
603 expectedChanged: true,
604 },

Callers

nothing calls this directly

Calls 13

PtrFunction · 0.92
TestCtxFunction · 0.92
GetTestBucketFunction · 0.92
NewCfgSGFunction · 0.92
NewSGReplicateManagerFunction · 0.85
isCfgChangedMethod · 0.80
CloseMethod · 0.65
StopMethod · 0.65
RunMethod · 0.65
UpsertMethod · 0.65
GetSingleDataStoreMethod · 0.45

Tested by

no test coverage detected