forked from opendatahub-io/opendatahub-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
19 lines (15 loc) · 674 Bytes
/
conftest.py
File metadata and controls
19 lines (15 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import shlex
import pytest
from ocp_utilities.monitoring import Prometheus
from pyhelper_utils.shell import run_command
def get_prometheus_k8s_token(duration: str = "1800s") -> str:
token_command = f"oc create token prometheus-k8s -n openshift-monitoring --duration={duration}"
command_success, out, _ = run_command(command=shlex.split(token_command), verify_stderr=False)
assert command_success, f"Command {token_command} failed to execute"
return out
@pytest.fixture(scope="session")
def prometheus_for_monitoring() -> Prometheus:
return Prometheus(
verify_ssl=False,
bearer_token=get_prometheus_k8s_token(duration="86400s"),
)