Skip to content

Commit

Permalink
feat: golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
atingchen committed Sep 6, 2022
1 parent 22146c5 commit 80fc04e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pdata/plog/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestLogsJSON_WithoutTraceIdAndSpanId(t *testing.T) {

var logsJSONWrongTraceID = `{"resourceLogs":[{"resource":{"attributes":[{"key":"host.name","value":{"stringValue":"testHost"}}]},"scopeLogs":[{"scope":{"name":"name","version":"version"},"logRecords":[{"severityText":"Error","body":{},"traceId":"--","spanId":""}]}]}]}`

func TestLogsJSON_WrongTraceId(t *testing.T) {
func TestLogsJSON_WrongTraceID(t *testing.T) {
decoder := NewJSONUnmarshaler()
_, err := decoder.UnmarshalLogs([]byte(logsJSONWrongTraceID))
assert.Error(t, err)
Expand All @@ -144,11 +144,11 @@ func TestLogsJSON_WrongTraceId(t *testing.T) {
}
}

var LogsJSONWrongSpanId = `{"resourceLogs":[{"resource":{"attributes":[{"key":"host.name","value":{"stringValue":"testHost"}}]},"scopeLogs":[{"scope":{"name":"name","version":"version"},"logRecords":[{"severityText":"Error","body":{},"traceId":"","spanId":"--"}]}]}]}`
var LogsJSONWrongSpanID = `{"resourceLogs":[{"resource":{"attributes":[{"key":"host.name","value":{"stringValue":"testHost"}}]},"scopeLogs":[{"scope":{"name":"name","version":"version"},"logRecords":[{"severityText":"Error","body":{},"traceId":"","spanId":"--"}]}]}]}`

func TestLogsJSON_WrongSpanId(t *testing.T) {
func TestLogsJSON_WrongSpanID(t *testing.T) {
decoder := NewJSONUnmarshaler()
_, err := decoder.UnmarshalLogs([]byte(LogsJSONWrongSpanId))
_, err := decoder.UnmarshalLogs([]byte(LogsJSONWrongSpanID))
assert.Error(t, err)
if assert.Error(t, err) {
assert.Contains(t, err.Error(), "parse span_id")
Expand Down

0 comments on commit 80fc04e

Please sign in to comment.