build(deps): bump openmldb from 0.8.2 to 0.8.3 #50
GitHub Actions / Monitoring integration test
failed
Sep 18, 2023 in 0s
Annotations
Check warning on line 0 in tests.test_exporter
github-actions / Monitoring integration test
test_deploy_response_time (tests.test_exporter) failed
./pytest.xml [took 1m 0s]
Raw output
assert 0.0 == 41
global_url = 'http://openmldb-exporter:8000/metrics'
conn = <sqlalchemy.engine.base.Connection object at 0x7f96af3f2d90>
api_url = 'http://openmldb-api:9527'
def test_deploy_response_time(global_url, conn, api_url):
response = requests.get(global_url)
metrics = text_string_to_metric_families(response.text)
old_deploy_sample_cnt = 0
for metric in metrics:
if metric.name == DEPLOY_METRIC_NAME:
old_deploy_sample_cnt = len(metric.samples)
db = "db" + str(int(time.time()))
tb = "tb" + str(int(time.time()))
dp = "dp" + str(int(time.time()))
conn.execute("create database " + db)
conn.execute("use " + db)
conn.execute(f"create table {tb} (id int, val string, ts timestamp)")
conn.execute(
f"deploy {dp} select id, count(val) over w as cnt from {tb} window w as (partition by id order by ts rows_range between 2s preceding and current row)"
)
post_ep = f"{api_url}/dbs/{db}/deployments/{dp}"
post_data = {"input": [[1, "12", 1000]]}
deploy_cnt = random.randint(5, 100)
for _ in range(deploy_cnt):
try:
res = requests.post(post_ep, json=post_data, timeout=5)
assert res.status_code == 200, f"{res}"
except Exception as e:
assert False, f"apiserver is down: {e}"
time.sleep(60)
response = requests.get(global_url)
metrics = text_string_to_metric_families(response.text)
new_bucket = 0
new_cnt = 0
new_sum = 0
new_cnt_value = 0
for metric in metrics:
print(metric)
if metric.name == DEPLOY_METRIC_NAME:
assert len(metric.samples) == old_deploy_sample_cnt + DEPLOY_SAMPLE_CNT_EACH_DEPLOY
for sample in metric.samples:
if sample.labels["deploy_path"] == db + "." + dp:
if sample.name == DEPLOY_METRIC_NAME_BUCKET:
new_bucket += 1
elif sample.name == DEPLOY_METRIC_NAME_COUNT:
new_cnt += 1
new_cnt_value = sample.value
elif sample.name == DEPLOY_METRIC_NAME_SUM:
new_sum += 1
> assert new_cnt_value == deploy_cnt
E assert 0.0 == 41
tests/test_exporter.py:201: AssertionError
Loading