-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clear dependencies. Move to sentry-go. Some refactoring, lints, tests. (
#2) * Clear dependencies * Move to sentry-go * Some refactoring, lints, tests * circleci fixes
- Loading branch information
1 parent
9680bee
commit 1a83227
Showing
13 changed files
with
452 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,7 @@ | |
vendor | ||
c.out | ||
coverage.html | ||
.golangci.yml | ||
golangci-lint | ||
.golangci*.yml | ||
bin/ | ||
linter.mk | ||
tests.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package log | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_contextFields(t *testing.T) { | ||
type tc struct { | ||
name string | ||
in context.Context | ||
exp map[string]interface{} | ||
} | ||
|
||
rID := newTestUUID("45bf025d-9e46-45a4-8562-c37c4d48a9ca") | ||
|
||
tcs := []tc{ | ||
{ | ||
name: "context with requers_id", | ||
in: context.WithValue(context.Background(), ctxRequestIDKey, rID), //nolint:staticcheck // да ладно! | ||
exp: map[string]interface{}{ctxRequestIDKey: rID.String()}, | ||
}, | ||
{ | ||
name: "empty context", | ||
in: context.Background(), | ||
exp: map[string]interface{}{}, | ||
}, | ||
{ | ||
name: "string equest id", | ||
in: context.WithValue(context.Background(), ctxRequestIDKey, rID.String()), //nolint:staticcheck // ну хорош! | ||
exp: map[string]interface{}{ctxRequestIDKey: rID.String()}, | ||
}, | ||
} | ||
|
||
t.Parallel() | ||
|
||
for _, tc := range tcs { | ||
tc := tc | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
out := contextFields(tc.in) | ||
|
||
assert.Equal(t, tc.exp, out) | ||
}) | ||
} | ||
} | ||
|
||
type testUUID struct { | ||
str string | ||
} | ||
|
||
func (t testUUID) String() string { | ||
return t.str | ||
} | ||
|
||
func newTestUUID(str string) testUUID { | ||
return testUUID{str: str} | ||
} |
Oops, something went wrong.