Skip to content

Commit

Permalink
Merge pull request #373 from pehala/fix_metrics
Browse files Browse the repository at this point in the history
Override Gateway for metrics tests
  • Loading branch information
pehala authored Apr 10, 2024
2 parents ee481e4 + f8dcdcb commit be144b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testsuite/openshift/metrics/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _wait_for_scrape():
return call_time < datetime.fromisoformat(target["lastScrape"][:26])
return False

assert _wait_for_scrape()
assert _wait_for_scrape(), "Prometheus didn't reconcile ServiceMonitor in time"

def close(self):
"""Close httpx client connection"""
Expand Down
17 changes: 17 additions & 0 deletions testsuite/tests/kuadrant/authorino/metrics/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest
from openshift_client import selector

from testsuite.gateway.envoy import Envoy
from testsuite.openshift.config_map import ConfigMap
from testsuite.openshift.metrics import ServiceMonitor, MetricsEndpoint, Prometheus

Expand Down Expand Up @@ -37,6 +38,22 @@ def prometheus(request, openshift):
return pytest.skip("Skipping metrics tests as query route is not properly configured")


@pytest.fixture(scope="module")
def gateway(request, authorino, openshift, blame, label, testconfig) -> Envoy:
"""Deploys Envoy that wires up the Backend behind the reverse-proxy and Authorino instance"""
gw = Envoy(
openshift,
blame("gw"),
authorino,
testconfig["service_protection"]["envoy"]["image"],
labels={"app": label},
)
request.addfinalizer(gw.delete)
gw.commit()
gw.wait_for_ready(timeout=10 * 60)
return gw


@pytest.fixture(scope="module")
def authorino(authorino, module_label):
"""Label Authorino controller-metrics service for the proper discovery"""
Expand Down

0 comments on commit be144b8

Please sign in to comment.