Skip to content

Commit

Permalink
feat: increase unittest coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyuancheung committed Nov 3, 2021
1 parent 36c5264 commit 79f35f0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
6 changes: 2 additions & 4 deletions semconv/v1.4.0/http_test.go
Expand Up @@ -867,10 +867,8 @@ func TestSpanStatusFromHTTPStatusCode(t *testing.T) {
assert.Empty(t, msg, "message should not be set if error can be inferred from code")
}
}
code, valid := validateHTTPStatusCode(400)
if !valid {
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")
}
code, _ := SpanStatusFromHTTPStatusCode(400, trace.SpanKindServer)
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")
}

func getExpectedCodeForHTTPCode(code int, spanKind trace.SpanKind) codes.Code {
Expand Down
6 changes: 2 additions & 4 deletions semconv/v1.5.0/http_test.go
Expand Up @@ -867,10 +867,8 @@ func TestSpanStatusFromHTTPStatusCode(t *testing.T) {
assert.Empty(t, msg, "message should not be set if error can be inferred from code")
}
}
code, valid := validateHTTPStatusCode(400)
if !valid {
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")
}
code, _ := SpanStatusFromHTTPStatusCode(400, trace.SpanKindServer)
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")
}

func getExpectedCodeForHTTPCode(code int, spanKind trace.SpanKind) codes.Code {
Expand Down
6 changes: 2 additions & 4 deletions semconv/v1.6.1/http_test.go
Expand Up @@ -866,10 +866,8 @@ func TestSpanStatusFromHTTPStatusCode(t *testing.T) {
assert.Empty(t, msg, "message should not be set if error can be inferred from code")
}
}
code, valid := validateHTTPStatusCode(400)
if !valid {
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")
}
code, _ := SpanStatusFromHTTPStatusCode(400, trace.SpanKindServer)
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")
}

func getExpectedCodeForHTTPCode(code int, spanKind trace.SpanKind) codes.Code {
Expand Down
7 changes: 3 additions & 4 deletions semconv/v1.7.0/http_test.go
Expand Up @@ -867,10 +867,9 @@ func TestSpanStatusFromHTTPStatusCode(t *testing.T) {
assert.Empty(t, msg, "message should not be set if error can be inferred from code")
}
}
code, valid := validateHTTPStatusCode(400)
if !valid {
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")
}
code, _ := SpanStatusFromHTTPStatusCode(400, trace.SpanKindServer)
assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code")

}

func getExpectedCodeForHTTPCode(code int, spanKind trace.SpanKind) codes.Code {
Expand Down

0 comments on commit 79f35f0

Please sign in to comment.