Skip to content

Commit 9b5b145

Browse files
Adds test
Signed-off-by: David Porter <[email protected]>
1 parent 5c95a18 commit 9b5b145

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

common/domain/replicationTaskExecutor_test.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,36 @@ func TestDomainReplicationTaskExecutor_Execute(t *testing.T) {
181181

182182
// Mock GetDomain to simulate domain fetch before update
183183
mockDomainManager.EXPECT().
184-
GetDomain(gomock.Any(), gomock.Any()).
184+
GetDomain(gomock.Any(), &persistence.GetDomainRequest{Name: "existingDomainName"}).
185185
Return(&persistence.GetDomainResponse{
186186
Info: &persistence.DomainInfo{ID: "existingDomainID", Name: "existingDomainName"},
187187
Config: &persistence.DomainConfig{},
188188
ReplicationConfig: &persistence.DomainReplicationConfig{},
189-
}, nil).AnyTimes()
189+
ConfigVersion: 1,
190+
FailoverVersion: 50,
191+
}, nil).Times(1)
190192

191193
// Mock UpdateDomain to simulate a successful domain update
192194
mockDomainManager.EXPECT().
193195
UpdateDomain(gomock.Any(), gomock.Any()).
194196
Return(nil).Times(1)
197+
198+
// Mock GetDomain after update for audit log
199+
mockDomainManager.EXPECT().
200+
GetDomain(gomock.Any(), &persistence.GetDomainRequest{ID: "existingDomainID"}).
201+
Return(&persistence.GetDomainResponse{
202+
Info: &persistence.DomainInfo{ID: "existingDomainID", Name: "existingDomainName"},
203+
Config: &persistence.DomainConfig{},
204+
ReplicationConfig: &persistence.DomainReplicationConfig{},
205+
ConfigVersion: 2,
206+
FailoverVersion: 100,
207+
}, nil).Times(1)
208+
209+
// Expect audit log creation
210+
mockAuditManager.EXPECT().
211+
CreateDomainAuditLog(gomock.Any(), gomock.Any()).
212+
Return(&persistence.CreateDomainAuditLogResponse{}, nil).
213+
Times(1)
195214
},
196215
task: &types.DomainTaskAttributes{
197216
DomainOperation: types.DomainOperationUpdate.Ptr(),

0 commit comments

Comments
 (0)