This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor remote sampler update logic (#36)
- Loading branch information
1 parent
dde99f5
commit 1b7c5b1
Showing
3 changed files
with
236 additions
and
94 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
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,40 @@ | ||
import pytest | ||
import tornado.web | ||
from urlparse import urlparse | ||
from jaeger_client.local_agent_net import LocalAgentSender | ||
from jaeger_client.config import DEFAULT_REPORTING_PORT | ||
|
||
test_strategy = """ | ||
{ | ||
"strategyType":0, | ||
"probabilisticSampling": | ||
{ | ||
"samplingRate":0.002 | ||
} | ||
} | ||
""" | ||
|
||
|
||
class AgentHandler(tornado.web.RequestHandler): | ||
def get(self): | ||
self.write(test_strategy) | ||
|
||
application = tornado.web.Application([ | ||
(r"/sampling", AgentHandler), | ||
]) | ||
|
||
@pytest.fixture | ||
def app(): | ||
return application | ||
|
||
|
||
@pytest.mark.gen_test | ||
def test_request_sampling_strategy(http_client, base_url): | ||
o = urlparse(base_url) | ||
sender = LocalAgentSender( | ||
host='localhost', | ||
sampling_port=o.port, | ||
reporting_port=DEFAULT_REPORTING_PORT | ||
) | ||
response = yield sender.request_sampling_strategy(service_name='svc', timeout=15) | ||
assert response.body == test_strategy |
Oops, something went wrong.