(t *testing.T)
| 545 | } |
| 546 | |
| 547 | func 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 | }, |
nothing calls this directly
no test coverage detected