Update policy for replacement of managed files
This commit is contained in:
@@ -117,6 +117,7 @@ func TestBuildSharedRootPlansOutputTakeoverByPolicy(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
takeover config.TakeoverPolicy
|
||||
transfer config.TransferPolicy
|
||||
ownerScope state.OwnerScope
|
||||
sameSource bool
|
||||
wantAction Action
|
||||
@@ -159,6 +160,13 @@ func TestBuildSharedRootPlansOutputTakeoverByPolicy(t *testing.T) {
|
||||
ownerScope: state.CurrentOwnerScope("reports", "web"),
|
||||
wantErr: "fail_conflict",
|
||||
},
|
||||
{
|
||||
name: "transfer conflict replacement allows managed owner conflict",
|
||||
takeover: config.TakeoverPolicy{Mode: config.TakeoverModeNever},
|
||||
transfer: config.TransferPolicy{OnConflict: config.TransferActionReplace},
|
||||
ownerScope: state.CurrentOwnerScope("other", "archive"),
|
||||
wantAction: ActionReplaceConflict,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -178,6 +186,9 @@ func TestBuildSharedRootPlansOutputTakeoverByPolicy(t *testing.T) {
|
||||
|
||||
req := sharedRootRequest(sourceBackend, destinationBackend, sourceBundle, config.ReconciliationModeReplace)
|
||||
req.Takeover = tt.takeover
|
||||
if tt.transfer.OnConflict != "" {
|
||||
req.Transfer.OnConflict = tt.transfer.OnConflict
|
||||
}
|
||||
plan, err := Build(context.Background(), req)
|
||||
if tt.wantErr != "" {
|
||||
if err == nil || !strings.Contains(err.Error(), tt.wantErr) {
|
||||
|
||||
Reference in New Issue
Block a user