Skip to content
Snippets Groups Projects
Commit 5c60ed9a authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

test: fix test_proc_runtime_info

parent 07d25039
No related branches found
No related tags found
1 merge request!855Gmoshkin/service auth
Pipeline #32416 passed
...@@ -1567,10 +1567,19 @@ def cluster( ...@@ -1567,10 +1567,19 @@ def cluster(
@pytest.fixture @pytest.fixture
def instance(cluster: Cluster) -> Generator[Instance, None, None]: def instance(cluster: Cluster, pytestconfig) -> Generator[Instance, None, None]:
"""Returns a deployed instance forming a single-node cluster.""" """Returns a deployed instance forming a single-node cluster."""
cluster.deploy(instance_count=1) instance = cluster.add_instance(wait_online=False)
yield cluster[0]
has_webui = bool(pytestconfig.getoption("--with-webui"))
if has_webui:
instance.env[
"PICODATA_HTTP_LISTEN"
] = f"{cluster.base_host}:{cluster.base_port+80}"
instance.start()
instance.wait_online()
yield instance
@pytest.fixture @pytest.fixture
......
...@@ -412,6 +412,7 @@ def test_proc_raft_info(instance: Instance): ...@@ -412,6 +412,7 @@ def test_proc_raft_info(instance: Instance):
) )
@pytest.mark.webui
def test_proc_runtime_info(instance: Instance): def test_proc_runtime_info(instance: Instance):
info = instance.call(".proc_runtime_info") info = instance.call(".proc_runtime_info")
...@@ -420,6 +421,12 @@ def test_proc_runtime_info(instance: Instance): ...@@ -420,6 +421,12 @@ def test_proc_runtime_info(instance: Instance):
# add a bootstrap entry. # add a bootstrap entry.
info["raft"]["applied"] = 69 info["raft"]["applied"] = 69
version_info = instance.call(".proc_version_info")
host_port = instance.env["PICODATA_HTTP_LISTEN"]
host, port = host_port.split(":")
port = int(port) # type: ignore
assert info == dict( assert info == dict(
raft=dict( raft=dict(
id=1, id=1,
...@@ -432,6 +439,11 @@ def test_proc_runtime_info(instance: Instance): ...@@ -432,6 +439,11 @@ def test_proc_runtime_info(instance: Instance):
main_loop_status="idle", main_loop_status="idle",
governor_loop_status="idle", governor_loop_status="idle",
), ),
http=dict(
host=host,
port=port,
),
version_info=version_info,
) )
......
from conftest import Cluster, Instance from conftest import Instance
from urllib.request import urlopen from urllib.request import urlopen
import pytest import pytest
import json import json
@pytest.fixture
def instance(cluster: Cluster):
instance = cluster.add_instance(wait_online=False)
instance.env["PICODATA_HTTP_LISTEN"] = f"{cluster.base_host}:{cluster.base_port+80}"
instance.start()
instance.wait_online()
return instance
def test_http_routes(instance: Instance): def test_http_routes(instance: Instance):
instance.eval( instance.eval(
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment