Skip to content

Goleak detects leaked goroutines from other tests #48

@denis-tingaikin

Description

@denis-tingaikin

Description

We've found an interesting thing during using goleak on our CI, that goleak can detect leaked goroutine from other tests.

Steps to reproduce

  1. Use go1.14.1 darwin/amd64
  2. Use goleak v1.0.0
  3. Run test file below
    goleak_test.go
package goleak_test

import (
	"go.uber.org/goleak"
	"testing"
	"time"
)

func TestA(t *testing.T) {
	go func() {
		for {
			<-time.After(time.Millisecond * 100)
		}
	}()
}

func TestB(t *testing.T) {
	defer goleak.VerifyNone(t)
}

Expected: TestB should pass
Actual: TestB fails with error "found unexpected goroutines:"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions