summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPavel Zhukov <33721692+LeaveMyYard@users.noreply.github.com>2024-03-26 13:24:56 +0200
committerGitHub <noreply@github.com>2024-03-26 13:24:56 +0200
commitba140253ac140acba61a0caf55791bed179ef297 (patch)
tree52437240088bb40894928b08a6b807521ea74bb2 /tests
parent4e450f3ecf7a7df161956fe1574392e9c406054c (diff)
Improving prometheus detection step (#236)
* Rework prometheus detection logging, fix #119 * Fix success if no scans were made * Fix get_history_range in tests * Remove unused constant --------- Co-authored-by: LeaveMyYard <zhukovpave2001@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 8906c42..61c389d 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -95,6 +95,19 @@ def mock_prometheus_load_pods():
@pytest.fixture(autouse=True, scope="session")
+def mock_prometheus_get_history_range():
+ async def get_history_range(self, history_duration: timedelta) -> tuple[datetime, datetime]:
+ now = datetime.now()
+ start = now - history_duration
+ return start, now
+
+ with patch(
+ "robusta_krr.core.integrations.prometheus.loader.PrometheusMetricsLoader.get_history_range", get_history_range
+ ):
+ yield
+
+
+@pytest.fixture(autouse=True, scope="session")
def mock_prometheus_init():
with patch("robusta_krr.core.integrations.prometheus.loader.PrometheusMetricsLoader.__init__", return_value=None):
yield