Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.
Merged
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
3 changes: 1 addition & 2 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ func NewAgent(options ...Option) (*Agent, error) {
agent.apiKey = configProfile.ApiKey
} else {
agent.logger.Println("API key not found, agent can't be started")
return nil, errors.New(fmt.Sprintf("There was a problem initializing Scope.\n"+
"Check the agent logs at %s for more information.\n", agent.recorderFilename))
return nil, errors.New("Scope DSN not found. Tests will run but no results will be reported to Scope. More info at https://docs.scope.dev/")
}
}

Expand Down
11 changes: 8 additions & 3 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"testing"

"go.undefinedlabs.com/scopeagent/agent"
"go.undefinedlabs.com/scopeagent/env"
"go.undefinedlabs.com/scopeagent/instrumentation"
"go.undefinedlabs.com/scopeagent/instrumentation/logging"
scopetesting "go.undefinedlabs.com/scopeagent/instrumentation/testing"
Expand All @@ -34,7 +35,9 @@ func Run(m *testing.M, opts ...agent.Option) int {
newAgent, err := agent.NewAgent(opts...)
if err != nil {
res := m.Run()
fmt.Printf("\n%v\n", err)
if env.ScopeDebug.Value {
fmt.Printf("\n%v\n", err)
}
return res
}

Expand All @@ -47,8 +50,10 @@ func Run(m *testing.M, opts ...agent.Option) int {
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
go func() {
<-sigs
instrumentation.Logger().Println("Terminating agent, sending partial results...")
newAgent.Stop()
if newAgent != nil {
instrumentation.Logger().Println("Terminating agent, sending partial results...")
newAgent.Stop()
}
os.Exit(1)
}()

Expand Down