Skip to content

Commit

Permalink
Change all Httpbin references to Backend
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Mar 6, 2024
1 parent f6a46ae commit 9acb45c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions testsuite/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

if TYPE_CHECKING:
from testsuite.openshift.client import OpenShiftClient
from testsuite.openshift.httpbin import Httpbin
from testsuite.backend import Backend


class Referencable(ABC):
Expand Down Expand Up @@ -164,7 +164,7 @@ def remove_all_hostnames(self):
"""Remove all hostnames from the Route"""

@abstractmethod
def add_backend(self, backend: "Httpbin", prefix):
def add_backend(self, backend: "Backend", prefix):
"""Adds another backend to the Route, with specific prefix"""

@abstractmethod
Expand Down
4 changes: 2 additions & 2 deletions testsuite/gateway/envoy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import yaml

from testsuite.openshift.httpbin import Httpbin
from testsuite.backend import Backend
from testsuite.openshift import modify
from testsuite.openshift.config_map import ConfigMap

Expand Down Expand Up @@ -108,7 +108,7 @@ def create_instance(
)

@modify
def add_backend(self, backend: Httpbin, prefix: str):
def add_backend(self, backend: Backend, prefix: str):
"""Adds backend to the EnvoyConfig"""
config = yaml.safe_load(self["envoy.yaml"])
config["static_resources"]["clusters"].append(yaml.safe_load(CLUSTER.replace("${backend_url}", backend.url)))
Expand Down
4 changes: 2 additions & 2 deletions testsuite/gateway/envoy/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

if typing.TYPE_CHECKING:
from testsuite.openshift.client import OpenShiftClient
from testsuite.openshift.httpbin import Httpbin
from testsuite.backend import Backend
from testsuite.policy.authorization.auth_config import AuthConfig


Expand All @@ -28,7 +28,7 @@ def __init__(self, openshift, gateway) -> None:
self.auth_configs: list["AuthConfig"] = []
self.hostnames: list[str] = []

def add_backend(self, backend: "Httpbin", prefix="/"):
def add_backend(self, backend: "Backend", prefix="/"):
self.gateway.config.add_backend(backend, prefix)
self.gateway.rollout()

Expand Down
8 changes: 4 additions & 4 deletions testsuite/gateway/gateway_api/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from testsuite.utils import asdict

if typing.TYPE_CHECKING:
from testsuite.openshift.httpbin import Httpbin
from testsuite.backend import Backend


class HTTPRoute(OpenShiftObject, GatewayRoute):
Expand Down Expand Up @@ -74,9 +74,9 @@ def remove_all_hostnames(self):
self.model.spec.hostnames = []

@modify
def add_rule(self, backend: "Httpbin", *route_matches: RouteMatch):
def add_rule(self, backend: "Backend", *route_matches: RouteMatch):
"""Adds rule to the Route"""
rules = {"backendRefs": [backend.reference]}
rules: dict[str, typing.Any] = {"backendRefs": [backend.reference]}
matches = list(route_matches)
if len(matches) == 0:
matches.append(RouteMatch(path=PathMatch(type=MatchType.PATH_PREFIX, value="/")))
Expand All @@ -90,7 +90,7 @@ def remove_all_rules(self):
self.model.spec.rules = []

@modify
def add_backend(self, backend: "Httpbin", prefix="/"):
def add_backend(self, backend: "Backend", prefix="/"):
self.model.spec.rules.append(
{"backendRefs": [backend.reference], "matches": [{"path": {"value": prefix, "type": "PathPrefix"}}]}
)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from testsuite.gateway import Gateway, GatewayRoute, Hostname, Exposer
from testsuite.oidc import OIDCProvider
from testsuite.oidc.auth0 import Auth0Provider
from testsuite.openshift.httpbin import Httpbin
from testsuite.backend.httpbin import Httpbin
from testsuite.oidc.rhsso import RHSSO
from testsuite.gateway.envoy import Envoy
from testsuite.gateway.envoy.route import EnvoyVirtualRoute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import pytest

from testsuite.openshift.secret import Secret
from testsuite.mockserver import Mockserver, MockserverBackend
from testsuite.mockserver import Mockserver
from testsuite.backend.mockserver import MockserverBackend
from testsuite.policy.dns_policy import HealthCheck, AdditionalHeadersRef

pytestmark = [pytest.mark.mgc]
Expand Down

0 comments on commit 9acb45c

Please sign in to comment.