@@ -85,13 +85,22 @@ func (tv *TestVars) stringNSetter(v string, n int) string {
85
85
return fmt .Sprintf ("%s_%d" , v , n )
86
86
}
87
87
88
- // Use this setter for entities that don't support setting n (like uuid).
88
+ // Generate new uuid for every new n.
89
+ func (tv * TestVars ) uuidNSetter (_ string , _ int ) string {
90
+ return tv .uuidString ("" )
91
+ }
92
+
93
+ func (tv * TestVars ) intNSetter (v int , n int ) int {
94
+ return n * 1000 + v
95
+ }
96
+
97
+ // Use this setter for entities that don't support setting n.
89
98
func unsupportedNSetter [T any ](v T , _ int ) T {
90
99
panic (fmt .Sprintf ("setting n on type %T is not supported" , v ))
91
100
}
92
101
93
102
func (tv * TestVars ) uniqueString (key string ) string {
94
- return tv . testName + "_" + key
103
+ return fmt . Sprintf ( "%s_%s" , tv . testName , key )
95
104
}
96
105
97
106
func (tv * TestVars ) uuidString (_ string ) string {
@@ -140,10 +149,13 @@ func (tv *TestVars) WithEntityN(n int) *TestVars {
140
149
*/
141
150
142
151
func (tv * TestVars ) NamespaceID () namespace.ID {
143
- return getOrCreate (tv , "namespace_id" , func (key string ) namespace.ID {
144
- return namespace .ID (tv .uuidString (key ))
145
- },
146
- unsupportedNSetter ,
152
+ return getOrCreate (tv , "namespace_id" ,
153
+ func (key string ) namespace.ID {
154
+ return namespace .ID (tv .uuidString (key ))
155
+ },
156
+ func (val namespace.ID , n int ) namespace.ID {
157
+ return namespace .ID (tv .uuidNSetter (val .String (), n ))
158
+ },
147
159
)
148
160
}
149
161
@@ -193,7 +205,7 @@ func (tv *TestVars) WithWorkflowIDN(n int) *TestVars {
193
205
}
194
206
195
207
func (tv * TestVars ) RunID () string {
196
- return getOrCreate (tv , "run_id" , tv .uuidString , unsupportedNSetter )
208
+ return getOrCreate (tv , "run_id" , tv .uuidString , tv . uuidNSetter )
197
209
}
198
210
199
211
func (tv * TestVars ) WithRunID (runID string ) * TestVars {
@@ -208,7 +220,7 @@ func (tv *TestVars) WorkflowExecution() *commonpb.WorkflowExecution {
208
220
}
209
221
210
222
func (tv * TestVars ) RequestID () string {
211
- return getOrCreate (tv , "request_id" , tv .uuidString , unsupportedNSetter )
223
+ return getOrCreate (tv , "request_id" , tv .uuidString , tv . uuidNSetter )
212
224
}
213
225
214
226
func (tv * TestVars ) BuildID () string {
0 commit comments