Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Reorganize tests to use go test -short and testing.Short() #7998

@rfay

Description

@rfay

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

We have a mechanism to run less tests, GOTEST_SHORT=true, with various extra things hung on that. But it's not really in line with the feature go uses for this.

Describe your solution

Use go test -short on tests that should do less.

Use t.Skip() to skip whole tests:

    if testing.Short() {
        t.Skip("skipping slow test in -short mode")
    }

Use if testing.Short() { to skip sections:

    if testing.Short() {
        cases = smallSmokeCaseList // fewer cases / smaller fixtures
    }

GOTEST_SHORT was originally intended for true/false to work like go test -short, but obviously I didn't know about that.

It was eventually expanded to specify particular project types, and that overloading is pretty ugly now. (We need it for certain situations, but it shouldn't be overloaded on "short".

https://pkg.go.dev/testing#hdr-Skipping

Describe alternatives

No response

Additional context

No response

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