Skip to content

testing: not clear whether parallel tests can run in parallel with themselves #18914

@mvdan

Description

@mvdan

https://golang.org/pkg/testing/#T.Parallel says:

Parallel signals that this test is to be run in parallel with (and only with) other parallel tests.

Is the test itself included in other parallel tests? You could understand that other means it's not included, but the wording isn't clear to me or a couple of people I've asked.

This is important because people (including myself) often write parallel tests in a way that they don't break other parallel tests, but not themselves. For example, it might use t.Name() as a unique identifier/key in a database.

I ran some quick tests and it does seem like a parallel test never runs in parallel with itself. Will post a doc CL soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions