Atlas › Test
extra_fields
Exact test identity: go.temporal.io/server/common/testing/parallelsuite/TestRun_RejectsSuite/extra_fields
- Package
go.temporal.io/server/common/testing/parallelsuite
- Suite / test hierarchy
TestRun_RejectsSuite/extra_fields
- Test
extra_fields
- Introduced at
- suite.go ×1 Frontier kind: Joint frontier
- Covered ranges
- 7
- Covered lines
- 29
- Covered files
- 1
Covered source
Expand a file to inspect source; the > gutter marks covered lines.
go.temporal.io/server/common/testing/parallelsuite/suite.go 29 covered LOC · 7 ranges
Open complete file
177
//
178
// The suite must embed [Suite] and have no other fields.
179
>
func Run[T testingSuite](t *testing.T, s T, args ...any) {
suite.go
180
>
run(t, s, true, args...)
181
>
}
182
183
// RunLegacySequential behaves like [Run] but does not mark test methods as parallel.
189
}
190
191
>
func run[T testingSuite](t *testing.T, s T, methodsParallel bool, args ...any) {
suite.go
192
>
t.Helper()
193
>
194
>
typ := reflect.TypeFor[T]()
195
>
if typ.Kind() != reflect.Pointer || typ.Elem().Kind() != reflect.Struct {
196
panic(fmt.Sprintf("parallelsuite.Run: suite must be a pointer to a struct, got %v", typ))
197
}
199
>
200
>
validateSuiteStruct(structType)
201
>
202
>
methods := discoverTestMethods(typ, structType, args)
203
>
if len(methods) == 0 {
204
panic(fmt.Sprintf("parallelsuite.Run: suite %s has no Test* methods", structType.Name()))
205
}
228
var inheritedMethods map[string]bool
229
231
>
type ds struct{ Suite[*ds] }
232
>
ptrType := reflect.TypeFor[*ds]()
233
>
inheritedMethods = make(map[string]bool, ptrType.NumMethod())
234
>
for method := range ptrType.Methods() {
235
>
inheritedMethods[method.Name] = true
236
>
}
237
}
238
239
>
func validateSuiteStruct(structType reflect.Type) {
suite.go
240
>
if !strings.HasSuffix(structType.Name(), "Suite") {
241
panic(fmt.Sprintf("parallelsuite.Run: struct name %q must end with \"Suite\"", structType.Name()))
242
}
243
244
>
if structType.NumField() != 1 {
suite.go
246
>
"parallelsuite.Run: suite %s must have no fields besides the embedded parallelsuite.Suite; "+
247
>
"pass parameters as extra args to Run instead (got %d fields)",
248
>
structType.Name(), structType.NumField(),
249
>
))
250
}
251
f := structType.Field(0)