Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
shruthilayaj committed Nov 8, 2024
1 parent 67372da commit c16e31b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
1 change: 1 addition & 0 deletions snuba/subscriptions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def time_shift(self, delta: float) -> Tick:
Returns a new ``Tick`` instance that has had the bounds of its time
interval shifted by the provided delta.
"""
breakpoint()
return Tick(
self.partition,
self.offsets,
Expand Down
29 changes: 10 additions & 19 deletions tests/subscriptions/test_scheduler_consumer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
import importlib
import json
import logging
Expand Down Expand Up @@ -196,7 +197,7 @@ def test_scheduler_consumer_rpc_subscriptions(tmpdir: LocalPath) -> None:
CreateSubscriptionRequestProto(
time_series_request=TimeSeriesRequest(
meta=RequestMeta(
project_ids=[1, 2, 3],
project_ids=[1],
organization_id=1,
cogs_category="something",
referrer="something",
Expand Down Expand Up @@ -282,24 +283,14 @@ def test_scheduler_consumer_rpc_subscriptions(tmpdir: LocalPath) -> None:

assert (tmpdir / "health.txt").check()
assert mock_scheduler_producer.produce.call_count == 2
assert json.loads(
mock_scheduler_producer.produce.call_args_list[0][0][1].value
) == {
"timestamp": "1970-01-01T00:16:00",
"entity": "eap_spans",
"task": {
"data": {
"project_id": 0,
"time_window": 300,
"resolution": 60,
"time_series_request": "Ch0IARIJc29tZXRoaW5nGglzb21ldGhpbmciAwECAxIUIhIKBwgBEgNmb28QBhoFEgNiYXIaGggBEg8IAxILdGVzdF9tZXRyaWMaA3N1bSABIKwC",
"request_version": "v1",
"request_name": "TimeSeriesRequest",
"subscription_type": "rpc",
}
},
"tick_upper_offset": 1,
}
payload = json.loads(mock_scheduler_producer.produce.call_args_list[0][0][1].value)
assert payload["task"]["data"]["project_id"] == 1
assert payload["task"]["data"]["resolution"] == 60
assert payload["task"]["data"]["time_window"] == 300
assert payload["task"]["data"]["request_name"] == "TimeSeriesRequest"
assert payload["task"]["data"]["request_version"] == "v1"
time_series_request = payload["task"]["data"]["time_series_request"]
TimeSeriesRequest().ParseFromString(base64.b64decode(time_series_request))

settings.TOPIC_PARTITION_COUNTS = {}

Expand Down

0 comments on commit c16e31b

Please sign in to comment.