This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* http spec test example * support for local-server based spec tests * read test cases from file: * the same test cases file as for C# * moved test cases file to testdata * updated to the lateat spec * attributes * fixed linter errors * fix sync issue * use already defined map instead
- Loading branch information
1 parent
8a36f74
commit 7396103
Showing
4 changed files
with
437 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This script downloads latest test cases from specs | ||
|
||
# TODO: change the link to when test cases are merged to specs repo | ||
|
||
curl https://raw.githubusercontent.com/census-instrumentation/opencensus-specs/master/trace/http-out-test-cases.json -o http-out-test-cases.json |
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,274 @@ | ||
[ | ||
{ | ||
"name": "Successful GET call to https://example.com", | ||
"method": "GET", | ||
"url": "https://example.com/", | ||
"spanName": "/", | ||
"spanStatus": "OK", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "example.com", | ||
"http.status_code": "200", | ||
"http.url": "https://example.com/" | ||
} | ||
}, | ||
{ | ||
"name": "Successfully POST call to https://example.com", | ||
"method": "POST", | ||
"url": "https://example.com/", | ||
"spanName": "/", | ||
"spanStatus": "OK", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "POST", | ||
"http.host": "example.com", | ||
"http.status_code": "200", | ||
"http.url": "https://example.com/" | ||
} | ||
}, | ||
{ | ||
"name": "Name is populated as a path", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/path/to/resource/", | ||
"responseCode": 200, | ||
"spanName": "/path/to/resource/", | ||
"spanStatus": "OK", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/path/to/resource/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "200", | ||
"http.url": "http://{host}:{port}/path/to/resource/" | ||
} | ||
}, | ||
{ | ||
"name": "Call that cannot resolve DNS will be reported as error span", | ||
"method": "GET", | ||
"url": "https://sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com/", | ||
"spanName": "/", | ||
"spanStatus": "UNKNOWN", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com", | ||
"http.url": "https://sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 199. This test case is not possible to implement on some platforms as they don't allow to return this status code. Keeping this test case for visibility, but it actually simply a fallback into 200 test case", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 200, | ||
"spanName": "/", | ||
"spanStatus": "OK", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "200", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 200", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 200, | ||
"spanName": "/", | ||
"spanStatus": "OK", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "200", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 399", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 399, | ||
"spanName": "/", | ||
"spanStatus": "OK", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "399", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 400", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 400, | ||
"spanName": "/", | ||
"spanStatus": "INVALID_ARGUMENT", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "400", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 401", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 401, | ||
"spanName": "/", | ||
"spanStatus": "UNAUTHENTICATED", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "401", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 403", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 403, | ||
"spanName": "/", | ||
"spanStatus": "PERMISSION_DENIED", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "403", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 404", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 404, | ||
"spanName": "/", | ||
"spanStatus": "NOT_FOUND", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "404", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 429", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 429, | ||
"spanName": "/", | ||
"spanStatus": "RESOURCE_EXHAUSTED", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "429", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 501", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 501, | ||
"spanName": "/", | ||
"spanStatus": "UNIMPLEMENTED", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "501", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 503", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 503, | ||
"spanName": "/", | ||
"spanStatus": "UNAVAILABLE", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "503", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 504", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 504, | ||
"spanName": "/", | ||
"spanStatus": "DEADLINE_EXCEEDED", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "504", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "Response code: 600", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"responseCode": 600, | ||
"spanName": "/", | ||
"spanStatus": "UNKNOWN", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "600", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
}, | ||
{ | ||
"name": "User agent attribute populated", | ||
"method": "GET", | ||
"url": "http://{host}:{port}/", | ||
"headers": { | ||
"User-Agent": "test-user-agent" | ||
}, | ||
"responseCode": 200, | ||
"spanName": "/", | ||
"spanStatus": "OK", | ||
"spanKind": "Client", | ||
"spanAttributes": { | ||
"http.path": "/", | ||
"http.method": "GET", | ||
"http.host": "{host}:{port}", | ||
"http.status_code": "200", | ||
"http.user_agent": "test-user-agent", | ||
"http.url": "http://{host}:{port}/" | ||
} | ||
} | ||
] |
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
Oops, something went wrong.