Skip to content

Trying to run tests in parallel with suite fails #1253

@pantelis-karamolegkos

Description

@pantelis-karamolegkos

I have several tests using testify/suite and I execute them in parallel as follows


type IntegrationSuite struct {
	suite.Suite
}

func TestIntegrationSuite(t *testing.T) {
	suite.Run(t, &IntegrationSuite{})
}

func (is *IntegrationSuite) TestSomething() {
	is.T().Log("\tIntegration Testing something")
	for i := range myTestTable {
		i := i
		is.T().Run("Testing "+myTestTable[i].scenarioName, func(_ *testing.T) {
			is.T().Parallel()
...

func (is *IntegrationSuite) TestSomethingElse() {
	is.T().Log("\tIntegration Testing something else")
	for i := range myOtherTestTable {
		i := i
		is.T().Run("Testing "+myOtherTestTable[i].scenarioName, func(_ *testing.T) {
			is.T().Parallel()
...
		})

However this panics with

panic: testing: t.Parallel called multiple times [recovered]
        panic: testing: t.Parallel called multiple times

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions