mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
fix style
This commit is contained in:
parent
c7c64636d0
commit
044eed8d82
@ -7,9 +7,10 @@ from helpers.cluster import ClickHouseCluster, run_and_check
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
|
||||
node1 = cluster.add_instance(
|
||||
"node1", main_configs=["config/text_log.xml"], mem_limit = "5g"
|
||||
"node1", main_configs=["config/text_log.xml"], mem_limit="5g"
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def started_cluster():
|
||||
try:
|
||||
@ -20,16 +21,19 @@ def started_cluster():
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
def get_latest_mem_limit():
|
||||
for _ in range(10):
|
||||
try:
|
||||
mem_limit = float(node1.query(
|
||||
'''
|
||||
select extract(message, '\\d+\\.\\d+') from system.text_log
|
||||
where message like '%Setting max_server_memory_usage was set to%' and
|
||||
message not like '%like%' order by event_time desc limit 1
|
||||
'''
|
||||
).strip())
|
||||
mem_limit = float(
|
||||
node1.query(
|
||||
"""
|
||||
select extract(message, '\\d+\\.\\d+') from system.text_log
|
||||
where message like '%Setting max_server_memory_usage was set to%' and
|
||||
message not like '%like%' order by event_time desc limit 1
|
||||
"""
|
||||
).strip()
|
||||
)
|
||||
return mem_limit
|
||||
except Exception as e:
|
||||
time.sleep(1)
|
||||
@ -37,15 +41,11 @@ def get_latest_mem_limit():
|
||||
|
||||
def test_observe_memory_limit(started_cluster):
|
||||
original_max_mem = get_latest_mem_limit()
|
||||
#container_id = cluster.get_container_id('node1')
|
||||
#cmd = "docker update --memory=10g {}".format(node1.docker_id)
|
||||
logging.debug(f"get original memory limit {original_max_mem}")
|
||||
run_and_check([
|
||||
'docker', 'update', '--memory=10g', node1.docker_id
|
||||
])
|
||||
run_and_check(['docker', 'update', '--memory=10g', node1.docker_id])
|
||||
for _ in range(30):
|
||||
time.sleep(10)
|
||||
new_max_mem = get_latest_mem_limit()
|
||||
new_max_mem = get_latest_mem_limit()
|
||||
logging.debug(f"get new memory limit {new_max_mem}")
|
||||
if new_max_mem > original_max_mem:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user