Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions autoinstrument/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/undefinedlabs/go-mpatch"

"go.undefinedlabs.com/scopeagent"
"go.undefinedlabs.com/scopeagent/env"
"go.undefinedlabs.com/scopeagent/instrumentation"
scopetesting "go.undefinedlabs.com/scopeagent/instrumentation/testing"
)
Expand Down Expand Up @@ -38,6 +39,18 @@ func init() {
return scopeagent.Run(m)
})
logOnError(err)

if !env.ScopeTestingDisableParallel.Value {
return
}
var t *testing.T
var tParallelMethod reflect.Method
tType := reflect.TypeOf(t)
if tParallelMethod, ok = tType.MethodByName("Parallel"); !ok {
return
}
_, err = mpatch.PatchMethodByReflect(tParallelMethod, func(t *testing.T) {})
logOnError(err)
})
}

Expand Down
1 change: 1 addition & 0 deletions env/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
ScopeTestingMode = newBooleanEnvVar(false, "SCOPE_TESTING_MODE")
ScopeTestingFailRetries = newIntEnvVar(0, "SCOPE_TESTING_FAIL_RETRIES")
ScopeTestingPanicAsFail = newBooleanEnvVar(false, "SCOPE_TESTING_PANIC_AS_FAIL")
ScopeTestingDisableParallel = newBooleanEnvVar(false, "SCOPE_TESTING_DISABLE_PARALLEL")
ScopeConfiguration = newSliceEnvVar([]string{tags.PlatformName, tags.PlatformArchitecture, tags.GoVersion}, "SCOPE_CONFIGURATION")
ScopeMetadata = newMapEnvVar(nil, "SCOPE_METADATA")
ScopeInstrumentationHttpPayloads = newBooleanEnvVar(false, "SCOPE_INSTRUMENTATION_HTTP_PAYLOADS")
Expand Down