@@ -67,7 +67,11 @@ func TestReplicationSimulation(t *testing.T) {
67
67
simCfg .MustInitClientsFor (t , clusterName )
68
68
}
69
69
70
- simCfg .MustRegisterDomain (t )
70
+ simTypes .Logf (t , "Registering domains" )
71
+ for domainName := range simCfg .Domains {
72
+ simTypes .Logf (t , "Domain: %s" , domainName )
73
+ simCfg .MustRegisterDomain (t , domainName )
74
+ }
71
75
72
76
// wait for domain data to be replicated and workers to start.
73
77
waitUntilWorkersReady (t )
@@ -115,14 +119,14 @@ func startWorkflow(
115
119
) error {
116
120
t .Helper ()
117
121
118
- simTypes .Logf (t , "Starting workflow: %s on cluster: %s" , op .WorkflowID , op .Cluster )
122
+ simTypes .Logf (t , "Starting workflow: %s on domain %s on cluster: %s" , op .WorkflowID , op . Domain , op .Cluster )
119
123
120
124
ctx , cancel := context .WithTimeout (context .Background (), 2 * time .Second )
121
125
defer cancel ()
122
126
resp , err := simCfg .MustGetFrontendClient (t , op .Cluster ).StartWorkflowExecution (ctx ,
123
127
& types.StartWorkflowExecutionRequest {
124
128
RequestID : uuid .New (),
125
- Domain : simCfg .Domain . Name ,
129
+ Domain : op .Domain ,
126
130
WorkflowID : op .WorkflowID ,
127
131
WorkflowType : & types.WorkflowType {Name : simTypes .WorkflowName },
128
132
TaskList : & types.TaskList {Name : simTypes .TasklistName },
@@ -135,7 +139,7 @@ func startWorkflow(
135
139
return err
136
140
}
137
141
138
- simTypes .Logf (t , "Started workflow: %s on cluster: %s. RunID: %s" , op .WorkflowID , op .Cluster , resp .GetRunID ())
142
+ simTypes .Logf (t , "Started workflow: %s on domain: %s on cluster: %s. RunID: %s" , op .WorkflowID , op . Domain , op .Cluster , resp .GetRunID ())
139
143
140
144
return nil
141
145
}
@@ -147,24 +151,24 @@ func changeActiveClusters(
147
151
) error {
148
152
t .Helper ()
149
153
150
- simTypes .Logf (t , "Changing active clusters to: %v" , op .NewActiveClusters )
154
+ simTypes .Logf (t , "Changing active clusters for domain %s to: %v" , op . Domain , op .NewActiveClusters )
151
155
152
156
ctx , cancel := context .WithTimeout (context .Background (), 2 * time .Second )
153
157
defer cancel ()
154
- descResp , err := simCfg .MustGetFrontendClient (t , simCfg .PrimaryCluster ).DescribeDomain (ctx , & types.DescribeDomainRequest {Name : common .StringPtr (simCfg .Domain . Name )})
158
+ descResp , err := simCfg .MustGetFrontendClient (t , simCfg .PrimaryCluster ).DescribeDomain (ctx , & types.DescribeDomainRequest {Name : common .StringPtr (op .Domain )})
155
159
if err != nil {
156
- return fmt .Errorf ("failed to describe domain %s: %w" , simCfg .Domain . Name , err )
160
+ return fmt .Errorf ("failed to describe domain %s: %w" , op .Domain , err )
157
161
}
158
162
159
- if ! simCfg .IsActiveActiveDomain () {
163
+ if ! simCfg .IsActiveActiveDomain (op . Domain ) {
160
164
fromCluster := descResp .ReplicationConfiguration .ActiveClusterName
161
165
toCluster := op .NewActiveClusters [0 ]
162
166
163
167
ctx , cancel = context .WithTimeout (context .Background (), 2 * time .Second )
164
168
defer cancel ()
165
169
_ , err = simCfg .MustGetFrontendClient (t , simCfg .PrimaryCluster ).UpdateDomain (ctx ,
166
170
& types.UpdateDomainRequest {
167
- Name : simCfg .Domain . Name ,
171
+ Name : op .Domain ,
168
172
ActiveClusterName : & toCluster ,
169
173
FailoverTimeoutInSeconds : op .FailoverTimeout ,
170
174
})
@@ -196,7 +200,7 @@ func validate(
196
200
defer cancel ()
197
201
resp , err := simCfg .MustGetFrontendClient (t , op .Cluster ).DescribeWorkflowExecution (ctx ,
198
202
& types.DescribeWorkflowExecutionRequest {
199
- Domain : simCfg .Domain . Name ,
203
+ Domain : op .Domain ,
200
204
Execution : & types.WorkflowExecution {
201
205
WorkflowID : op .WorkflowID ,
202
206
},
@@ -214,7 +218,7 @@ func validate(
214
218
215
219
// Get history to validate the worker identity that started and completed the workflow
216
220
// Some workflows start in cluster0 and complete in cluster1. This is to validate that
217
- history , err := getAllHistory (t , simCfg , op .Cluster , op .WorkflowID )
221
+ history , err := getAllHistory (t , simCfg , op .Cluster , op .Domain , op . WorkflowID )
218
222
if err != nil {
219
223
return err
220
224
}
@@ -227,17 +231,17 @@ func validate(
227
231
if err != nil {
228
232
return err
229
233
}
230
- if op .Want .StartedByWorkersInCluster != "" && startedWorker != simTypes .WorkerIdentityFor (op .Want .StartedByWorkersInCluster ) {
231
- return fmt .Errorf ("workflow %s started by worker %s, expected %s" , op .WorkflowID , startedWorker , simTypes .WorkerIdentityFor (op .Want .StartedByWorkersInCluster ))
234
+ if op .Want .StartedByWorkersInCluster != "" && startedWorker != simTypes .WorkerIdentityFor (op .Want .StartedByWorkersInCluster , op . Domain ) {
235
+ return fmt .Errorf ("workflow %s started by worker %s, expected %s" , op .WorkflowID , startedWorker , simTypes .WorkerIdentityFor (op .Want .StartedByWorkersInCluster , op . Domain ))
232
236
}
233
237
234
238
completedWorker , err := lastDecisionTaskWorker (history )
235
239
if err != nil {
236
240
return err
237
241
}
238
242
239
- if op .Want .CompletedByWorkersInCluster != "" && completedWorker != simTypes .WorkerIdentityFor (op .Want .CompletedByWorkersInCluster ) {
240
- return fmt .Errorf ("workflow %s completed by worker %s, expected %s" , op .WorkflowID , completedWorker , simTypes .WorkerIdentityFor (op .Want .CompletedByWorkersInCluster ))
243
+ if op .Want .CompletedByWorkersInCluster != "" && completedWorker != simTypes .WorkerIdentityFor (op .Want .CompletedByWorkersInCluster , op . Domain ) {
244
+ return fmt .Errorf ("workflow %s completed by worker %s, expected %s" , op .WorkflowID , completedWorker , simTypes .WorkerIdentityFor (op .Want .CompletedByWorkersInCluster , op . Domain ))
241
245
}
242
246
243
247
return nil
@@ -273,14 +277,14 @@ func waitForOpTime(t *testing.T, op *simTypes.Operation, startTime time.Time) {
273
277
simTypes .Logf (t , "Operation time (t + %ds) reached: %v" , int (op .At .Seconds ()), startTime .Add (op .At ))
274
278
}
275
279
276
- func getAllHistory (t * testing.T , simCfg * simTypes.ReplicationSimulationConfig , clusterName , wfID string ) ([]types.HistoryEvent , error ) {
280
+ func getAllHistory (t * testing.T , simCfg * simTypes.ReplicationSimulationConfig , clusterName , domainName , wfID string ) ([]types.HistoryEvent , error ) {
277
281
frontendCl := simCfg .MustGetFrontendClient (t , clusterName )
278
282
var nextPageToken []byte
279
283
var history []types.HistoryEvent
280
284
for {
281
285
ctx , cancel := context .WithTimeout (context .Background (), 2 * time .Second )
282
286
response , err := frontendCl .GetWorkflowExecutionHistory (ctx , & types.GetWorkflowExecutionHistoryRequest {
283
- Domain : simCfg . Domain . Name ,
287
+ Domain : domainName ,
284
288
Execution : & types.WorkflowExecution {
285
289
WorkflowID : wfID ,
286
290
},
0 commit comments