-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include a new downsampling operation #1574
Changes from 19 commits
1f4e757
126e99c
54b9829
61ade59
edf2e08
81db5c6
1446d12
b81526d
433726c
97e2922
e4a8d81
d813ce0
01d0d75
571b712
aaac8c5
2424935
1f3ed4b
693a9d3
476a573
d5e5ffe
9d1c257
cad9f53
7e063e2
ad1a9a6
104a715
21cc596
029babb
86e05ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2772,3 +2772,41 @@ def test_force_merge_all_params(self): | |
assert p["request-timeout"] == 30 | ||
assert p["max-num-segments"] == 1 | ||
assert p["mode"] == "polling" | ||
|
||
|
||
class TestDownsampleParamSource: | ||
def test_downsample_all_params(self): | ||
source = params.DownsampleParamSource( | ||
track.Track(name="unit-test"), | ||
params={"source-index": "test-source-index", "target-index": "test-target-index", "fixed-interval": "1m"}, | ||
) | ||
|
||
p = source.params() | ||
|
||
assert p["fixed-interval"] == "1m" | ||
assert p["source-index"] == "test-source-index" | ||
assert p["target-index"] == "test-target-index" | ||
|
||
def test_downsample_target_index_param(self): | ||
source = params.DownsampleParamSource( | ||
track.Track(name="unit-test"), | ||
params={"source-index": "tsdb", "fixed-interval": "1m"}, | ||
) | ||
|
||
p = source.params() | ||
|
||
assert p["fixed-interval"] == "1m" | ||
assert p["source-index"] == "tsdb" | ||
assert p["target-index"] == "tsdb-1m" | ||
|
||
def test_downsample_empty_params(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this test buys us? Checked with a debugger and captured the value of p: {'fixed-interval': '1h', 'source-index': None, 'target-index': 'None-1h', 'request-timeout': None, 'headers': None, 'opaque-id': None} Might be better instead to have the Track constructor call include an |
||
source = params.DownsampleParamSource( | ||
track.Track(name="unit-test"), | ||
params={}, | ||
) | ||
|
||
p = source.params() | ||
|
||
assert p["fixed-interval"] != "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be the documented default, and should need changing if the default changes |
||
assert p["source-index"] != "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To put my above comment slightly differently, this assert only passes because the |
||
assert p["target-index"] == f"{p['source-index']}-{p['fixed-interval']}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.