forked from Kuadrant/testsuite
-
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.
- Loading branch information
Showing
5 changed files
with
78 additions
and
0 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
Empty file.
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,18 @@ | ||
"""Conftest for tracing tests""" | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def authorino_parameters(authorino_parameters, jaeger): | ||
"""Deploy authorino with tracing enabled""" | ||
authorino_parameters["tracing_endpoint"] = jaeger.collector_url | ||
authorino_parameters["tracing_insecure"] = True | ||
return authorino_parameters | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def authorization(authorization): | ||
"""Add response with 'request.id' to found this traced request later in Jaeger""" | ||
authorization.responses.add_simple("request.id") | ||
return authorization |
18 changes: 18 additions & 0 deletions
18
testsuite/tests/kuadrant/authorino/tracing/test_tracing.py
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,18 @@ | ||
"""Test tracing with Jaeger""" | ||
|
||
import pytest | ||
|
||
from testsuite.utils import extract_response | ||
|
||
pytestmark = [pytest.mark.authorino, pytest.mark.standalone_only] | ||
|
||
|
||
def test_tracing(client, auth, jaeger): | ||
"""Send request and check if it's trace is saved to Jaeger""" | ||
response = client.get("/get", auth=auth) | ||
assert response.status_code == 200 | ||
|
||
request_id = extract_response(response) % None | ||
assert request_id is not None | ||
|
||
assert jaeger.find_trace("Check", request_id) |
30 changes: 30 additions & 0 deletions
30
testsuite/tests/kuadrant/authorino/tracing/test_tracing_tags.py
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,30 @@ | ||
"""Test custom tags set for request traces""" | ||
|
||
import pytest | ||
|
||
from testsuite.utils import extract_response | ||
|
||
pytestmark = [pytest.mark.authorino, pytest.mark.standalone_only] | ||
|
||
|
||
TAG_KEY = "test-key" | ||
TAG_VALUE = "test-value" | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def authorino_parameters(authorino_parameters): | ||
"""Deploy authorino with tracing enabled and custom tags set""" | ||
authorino_parameters["tracing_tags"] = {TAG_KEY: TAG_VALUE} | ||
return authorino_parameters | ||
|
||
|
||
def test_tracing_tags(client, auth, jaeger): | ||
"""Send request and check if it's trace with custom tags is saved to Jaeger""" | ||
response = client.get("/get", auth=auth) | ||
assert response.status_code == 200 | ||
|
||
request_id = extract_response(response) % None | ||
assert request_id is not None | ||
|
||
# extra quotes are added by authorino and are a bug for now | ||
assert jaeger.find_tagged_trace("Check", request_id, f'"{TAG_KEY}', f'{TAG_VALUE}"') |