-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathtest_issue4895.py
More file actions
55 lines (43 loc) · 1.46 KB
/
test_issue4895.py
File metadata and controls
55 lines (43 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import unittest
from feldera.pipeline_builder import PipelineBuilder
from feldera.testutils import (
unique_pipeline_name,
FELDERA_TEST_NUM_WORKERS,
FELDERA_TEST_NUM_HOSTS,
)
from tests import TEST_CLIENT
from feldera.enums import PipelineStatus
from feldera.runtime_config import RuntimeConfig
class TestIssue4895(unittest.TestCase):
def test_issue4895(self):
"""
LATENESS is applied correctly to materialized tables
"""
pipeline_name = unique_pipeline_name("test_issue4895")
sql = """
create table t (x int lateness 0) with
('materialized' = 'true');
"""
pipeline = PipelineBuilder(
TEST_CLIENT,
pipeline_name,
sql=sql,
runtime_config=RuntimeConfig(
workers=FELDERA_TEST_NUM_WORKERS,
hosts=FELDERA_TEST_NUM_HOSTS,
),
).create_or_replace()
pipeline.start()
assert pipeline.status() == PipelineStatus.RUNNING
pipeline.input_json("t", {"x": 1})
pipeline.input_json("t", {"x": 2})
pipeline.input_json("t", {"x": 3})
result = list(pipeline.query("SELECT * FROM t;"))
assert len(result) == 3
# Late row should have no effect
pipeline.input_json("t", {"x": 0})
result = list(pipeline.query("SELECT * FROM t;"))
assert len(result) == 3
pipeline.stop(force=True)
if __name__ == "__main__":
unittest.main()