6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/functional/monitoring/test_02.py

44 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-02-04 19:05:19 +01:00
"""
ID: monitoring-tables-02
TITLE: Get data about active statements from current attachment (WHERE-filter: mon$statements.mon$state=1).
DESCRIPTION:
FBTEST: functional.monitoring.02
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set width usr 31;
set list on;
select a.mon$user usr, s.mon$sql_text sql_text
from mon$attachments a
join mon$statements s on a.mon$attachment_id = s.mon$attachment_id
where
a.mon$attachment_id = current_connection
and s.mon$state = 1;
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
act = isql_act('db', test_script, substitutions=[('SQL_TEXT.*', '')])
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
expected_stdout = """
USR SYSDBA
2021-04-26 20:07:00 +02:00
SQL_TEXT 0:1
select a.mon$user usr, s.mon$sql_text sql_text
from mon$attachments a
join mon$statements s on a.mon$attachment_id = s.mon$attachment_id
where
a.mon$attachment_id = current_connection
and s.mon$state = 1
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-02-04 19:05:19 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout