Skip to content

Commit

Permalink
fix: Use "example.com" host in example/test DSNs (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyo authored Jan 9, 2023
1 parent 84f883b commit 6588be3
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func setupClientTest() (*Client, *ScopeMock, *TransportMock) {
scope := &ScopeMock{}
transport := &TransportMock{}
client, _ := NewClient(ClientOptions{
Dsn: "http://whatever@really.com/1337",
Dsn: "http://whatever@example.com/1337",
Transport: transport,
Integrations: func(i []Integration) []Integration {
return []Integration{}
Expand Down
2 changes: 1 addition & 1 deletion example/feature-showcase/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func eventHint() {
func main() {
if err := sentry.Init(sentry.ClientOptions{
Debug: true,
Dsn: "https://hello@world.io/1337",
Dsn: "https://hello@example.com/1337",
IgnoreErrors: []string{"^(?i)drop me"},
BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {
if ex, ok := hint.OriginalException.(CustomComplexError); ok {
Expand Down
2 changes: 1 addition & 1 deletion example/flush/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func main() {
_ = sentry.Init(sentry.ClientOptions{
Dsn: "https://hello@world.io/1337",
Dsn: "https://hello@example.com/1337",
Debug: true,
})

Expand Down
4 changes: 2 additions & 2 deletions example/multiclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (pi *pickleIntegration) processor(event *sentry.Event, hint *sentry.EventHi
func main() {
scope1 := sentry.NewScope()
client1, _ := sentry.NewClient(sentry.ClientOptions{
Dsn: "https://hello@world.io/1",
Dsn: "https://hello@example.com/1",
BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {
log.Println(event.Message)
return nil
Expand All @@ -38,7 +38,7 @@ func main() {

scope2 := sentry.NewScope()
client2, _ := sentry.NewClient(sentry.ClientOptions{
Dsn: "https://hello@world.io/2",
Dsn: "https://hello@example.com/2",
BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {
log.Println(event.Message)
return nil
Expand Down
2 changes: 1 addition & 1 deletion example/recover/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func bazMsg() {
func main() {
_ = sentry.Init(sentry.ClientOptions{
Debug: true,
Dsn: "https://hello@world.io/1337",
Dsn: "https://hello@example.com/1337",
AttachStacktrace: true,
BeforeSend: func(e *sentry.Event, h *sentry.EventHint) *sentry.Event {
fmt.Println(prettyPrint(e))
Expand Down
2 changes: 1 addition & 1 deletion example/synctransport/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func main() {
sentrySyncTransport.Timeout = time.Second * 3

_ = sentry.Init(sentry.ClientOptions{
Dsn: "https://hello@world.io/1337",
Dsn: "https://hello@example.com/1337",
Debug: true,
Transport: sentrySyncTransport,
})
Expand Down
2 changes: 1 addition & 1 deletion example/with_extra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (ee ExtractExtra) SetupOnce(client *sentry.Client) {
func main() {
if err := sentry.Init(sentry.ClientOptions{
Debug: true,
Dsn: "https://hello@world.io/1337",
Dsn: "https://hello@example.com/1337",
BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {
// Solution 1 (use beforeSend, which will be applied to
// error events and is usually application specific):
Expand Down
8 changes: 5 additions & 3 deletions hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
)

const testDsn = "http://whatever@example.com/1337"

func setupHubTest() (*Hub, *Client, *Scope) {
client, _ := NewClient(ClientOptions{Dsn: "http://whatever@really.com/1337"})
client, _ := NewClient(ClientOptions{Dsn: testDsn})
scope := NewScope()
hub := NewHub(client, scope)
return hub, client, scope
Expand Down Expand Up @@ -93,7 +95,7 @@ func TestPopScopeCannotLeaveStackEmpty(t *testing.T) {
func TestBindClient(t *testing.T) {
hub, client, _ := setupHubTest()
hub.PushScope()
newClient, _ := NewClient(ClientOptions{Dsn: "http://whatever@really.com/1337"})
newClient, _ := NewClient(ClientOptions{Dsn: testDsn})
hub.BindClient(newClient)

if (*hub.stack)[0].client == (*hub.stack)[1].client {
Expand Down Expand Up @@ -121,7 +123,7 @@ func TestWithScopeBindClient(t *testing.T) {
hub, client, _ := setupHubTest()

hub.WithScope(func(scope *Scope) {
newClient, _ := NewClient(ClientOptions{Dsn: "http://whatever@really.com/1337"})
newClient, _ := NewClient(ClientOptions{Dsn: testDsn})
hub.BindClient(newClient)
if hub.stackTop().client != newClient {
t.Error("should use newly bound client")
Expand Down

0 comments on commit 6588be3

Please sign in to comment.