go.undefinedlabs.com/scopeagent@v0.4.2/init_test.go (about)

     1  package scopeagent_test
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/opentracing/opentracing-go"
     9  
    10  	"go.undefinedlabs.com/scopeagent"
    11  	_ "go.undefinedlabs.com/scopeagent/autoinstrument"
    12  )
    13  
    14  func TestMain(m *testing.M) {
    15  	os.Exit(m.Run())
    16  }
    17  
    18  func TestFromGoroutineRace(t *testing.T) {
    19  	ctx := scopeagent.GetContextFromTest(t)
    20  	span := opentracing.SpanFromContext(ctx)
    21  
    22  	for x := 0; x<10;x++ {
    23  		go func() {
    24  			for i := 0; i < 100; i++ {
    25  				span.SetTag(fmt.Sprintf("Key%v", i), i)
    26  			}
    27  		}()
    28  	}
    29  }