Skip to content

Commit

Permalink
fix review comments, define explicit prop names in structs
Browse files Browse the repository at this point in the history
  • Loading branch information
pavolloffay committed Aug 16, 2017
1 parent 2b406ae commit 3211e3d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
14 changes: 7 additions & 7 deletions cmd/collector/app/zipkin/http_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ func TestJsonFormat(t *testing.T) {
expected string
statusCode int
}{
{spanJSON, "Cannot submit Zipkin batch: Bad times ahead\n", http.StatusInternalServerError},
{createSpan("bar", "", "1", "1", 156, 15145, false, annoJSON, binAnnoJSON),
"Unable to process request body: id is not an unsigned long\n", http.StatusBadRequest},
{createSpan("bar", "ZTA", "1", "1", 156, 15145, false, "", ""),
"Unable to process request body: id is not an unsigned long\n", http.StatusBadRequest},
{createSpan("bar", "1", "", "1", 156, 15145, false, "", createAnno("cs", 1, endpErrJSON)),
"Unable to process request body: wrong ipv4\n", http.StatusBadRequest},
{payload: spanJSON, expected: "Cannot submit Zipkin batch: Bad times ahead\n", statusCode: http.StatusInternalServerError},
{payload: createSpan("bar", "", "1", "1", 156, 15145, false, annoJSON, binAnnoJSON),
expected: "Unable to process request body: id is not an unsigned long\n", statusCode: http.StatusBadRequest},
{payload: createSpan("bar", "ZTA", "1", "1", 156, 15145, false, "", ""),
expected: "Unable to process request body: id is not an unsigned long\n", statusCode: http.StatusBadRequest},
{payload: createSpan("bar", "1", "", "1", 156, 15145, false, "", createAnno("cs", 1, endpErrJSON)),
expected: "Unable to process request body: wrong ipv4\n", statusCode: http.StatusBadRequest},
}

for _, test := range tests {
Expand Down
33 changes: 16 additions & 17 deletions cmd/collector/app/zipkin/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ func TestSpanToThrift(t *testing.T) {
Key: "error",
Value: "str",
}

span := zipkinSpan{
ID: "bd7a977555f6b982",
TraceID: "bd7a974555f6b982bd71977555f6b981",
Expand All @@ -285,24 +284,24 @@ func TestSpanToThrift(t *testing.T) {
err error
}{
{
zipkinSpan{ID: "zd7a977555f6b982", TraceID: "bd7a977555f6b982"},
errIsNotUnsignedLog,
span: zipkinSpan{ID: "zd7a977555f6b982", TraceID: "bd7a977555f6b982"},
err: errIsNotUnsignedLog,
},
{
zipkinSpan{ID: "ad7a977555f6b982", TraceID: "zd7a977555f6b982"},
errIsNotUnsignedLog,
span: zipkinSpan{ID: "ad7a977555f6b982", TraceID: "zd7a977555f6b982"},
err: errIsNotUnsignedLog,
},
{
zipkinSpan{ID: "ad7a977555f6b982", TraceID: "ad7a977555f6b982", ParentID: "zd7a977555f6b982"},
errIsNotUnsignedLog,
span: zipkinSpan{ID: "ad7a977555f6b982", TraceID: "ad7a977555f6b982", ParentID: "zd7a977555f6b982"},
err: errIsNotUnsignedLog,
},
{
zipkinSpan{ID: "1", TraceID: "1", Annotations: []annotation{{Endpoint: endpoint{IPv4: "127.0.0.A"}}}},
errWrongIpv4,
span: zipkinSpan{ID: "1", TraceID: "1", Annotations: []annotation{{Endpoint: endpoint{IPv4: "127.0.0.A"}}}},
err: errWrongIpv4,
},
{
zipkinSpan{ID: "1", TraceID: "1", BinaryAnnotations: []binaryAnnotation{{Endpoint: endpoint{IPv4: "127.0.0.A"}}}},
errWrongIpv4,
span: zipkinSpan{ID: "1", TraceID: "1", BinaryAnnotations: []binaryAnnotation{{Endpoint: endpoint{IPv4: "127.0.0.A"}}}},
err: errWrongIpv4,
},
}

Expand All @@ -319,9 +318,9 @@ func TestHexToUnsignedLong(t *testing.T) {
hex string
expected uint64
}{
{"0", 0},
{"ffffffffffffffff", math.MaxUint64},
{"00000000000000001", 1},
{hex: "0", expected: 0},
{hex: "ffffffffffffffff", expected: math.MaxUint64},
{hex: "00000000000000001", expected: 1},
}
for _, test := range okTests {
num, err := hexToUnsignedLong(test.hex)
Expand All @@ -339,9 +338,9 @@ func TestHexToUnsignedLong(t *testing.T) {
errTests := []struct {
hex string
}{
{"fffffffffffffffffffffffffffffffff"},
{""},
{"po"},
{hex: "fffffffffffffffffffffffffffffffff"},
{hex: ""},
{hex: "po"},
}
for _, test := range errTests {
num, err = hexToUnsignedLong(test.hex)
Expand Down

0 comments on commit 3211e3d

Please sign in to comment.