Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracer TestUserMonitoring: Wait for goroutines before test completes #2263

Merged
merged 2 commits into from
Oct 12, 2023

Commits on Oct 11, 2023

  1. tracer TestUserMonitoring: Wait for goroutines before test completes

    This test starts a set of goroutines which do things to spans after
    they have finished. Wait for these goroutines to complete before
    ending the test function. This ensures these goroutines are not
    running when other tests run. This avoids these tests accidentally
    capturing the logs from these goroutines, and avoids the race
    detector triggering on things they are doing.
    
    This fixes a problem when running tests with -shuffle=on, and also
    fixes a race detector warning:
    
    ==================
    WARNING: DATA RACE
    Write at 0x000103d80470 by goroutine 74703:
      gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer.setTestTime()
          /Users/evan.jones/dd/dd-trace-go/ddtrace/tracer/abandonedspans_test.go:28 +0xf8
      gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer.TestReportAbandonedSpans.func2()
          /Users/evan.jones/dd/dd-trace-go/ddtrace/tracer/abandonedspans_test.go:81 +0x44
      testing.tRunner()
          /opt/homebrew/Cellar/go/1.21.2/libexec/src/testing/testing.go:1595 +0x194
      testing.(*T).Run.func1()
          /opt/homebrew/Cellar/go/1.21.2/libexec/src/testing/testing.go:1648 +0x40
    
    Previous read at 0x000103d80470 by goroutine 74356:
      gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer.(*span).Finish()
          /Users/evan.jones/dd/dd-trace-go/ddtrace/tracer/span.go:423 +0x3c
      gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer.TestUserMonitoring.func5.2()
          /Users/evan.jones/dd/dd-trace-go/ddtrace/tracer/tracer_test.go:2331 +0xc4
    
    Goroutine 74703 (running) created at:
      testing.(*T).Run()
          /opt/homebrew/Cellar/go/1.21.2/libexec/src/testing/testing.go:1648 +0x5d8
      gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer.TestReportAbandonedSpans()
          /Users/evan.jones/dd/dd-trace-go/ddtrace/tracer/abandonedspans_test.go:79 +0x204
      testing.tRunner()
          /opt/homebrew/Cellar/go/1.21.2/libexec/src/testing/testing.go:1595 +0x194
      testing.(*T).Run.func1()
          /opt/homebrew/Cellar/go/1.21.2/libexec/src/testing/testing.go:1648 +0x40
    
    Goroutine 74356 (running) created at:
      gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer.TestUserMonitoring.func5()
          /Users/evan.jones/dd/dd-trace-go/ddtrace/tracer/tracer_test.go:2329 +0x154
      testing.tRunner()
          /opt/homebrew/Cellar/go/1.21.2/libexec/src/testing/testing.go:1595 +0x194
      testing.(*T).Run.func1()
          /opt/homebrew/Cellar/go/1.21.2/libexec/src/testing/testing.go:1648 +0x40
    ==================
    evanj committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    9bee041 View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2023

  1. Configuration menu
    Copy the full SHA
    606710f View commit details
    Browse the repository at this point in the history