Skip to content

[GRPCRoute] Configure GRPCRoute parametrization on existing tests #891

@averevki

Description

@averevki

Summary

Implement GRPCRoute class, route factory, and fixture parametrization so that existing tests can run against both HTTPRoute and GRPCRoute. This includes parametrizing baseline smoke tests, extension policy tests, and adding GRPCRoute-specific tests.

Motivation

The GRPCRoute support RFC requires E2E test coverage for all Kuadrant policies targeting GRPCRoute. The testsuite's existing indirect fixture parametrization pattern should be extended to support route type switching, enabling tests to run against both HTTPRoute and GRPCRoute with minimal code changes.

Implementation

GRPCRoute Class & Route Factory

  • Create GRPCMethodMatch and GRPCRouteMatch dataclasses in testsuite/gateway/__init__.py
  • Implement GRPCRoute class in testsuite/gateway/gateway_api/grpc_route.py implementing GatewayRoute
  • Implement route factory method for route type selection

Fixture Parametrization

Extend fixtures in testsuite/tests/singlecluster/conftest.py:

  • route fixture: support GRPCRoute creation via @pytest.mark.parametrize("route", ["http", "grpc"], indirect=True)
  • backend fixture: switch between httpbin and gRPC backend based on route type
  • client fixture: switch between HTTP and gRPC client based on route type

Baseline Tests to Parametrize

Data plane & infrastructure policy tests (make smoke):

  • tests/singlecluster/authorino/identity/api_key/test_auth_credentials.py::test_custom_selector[authorizationHeader]
  • tests/singlecluster/gateway/test_basic.py::test_gateway_readiness
  • tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-route]
  • tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-gateway]
  • tests/singlecluster/gateway/test_basic.py::test_gateway_basic_dns_tls

Extension policy tests:

  • tests/singlecluster/extensions/telemetry_policy/test_telemetry_policy_api_key_auth.py — TelemetryPolicy custom labels with API key auth
  • tests/singlecluster/extensions/plan_policy/test_plan_policy.py — PlanPolicy tier enforcement with Keycloak OIDC
  • tests/singlecluster/extensions/oidc_policy/test_oidc_policy_public_client.py — OIDCPolicy public client PKCE flow

GRPCRoute-Specific Tests

  • GRPCRoute sectionName targeting tests (AuthPolicy + RateLimitPolicy)
  • GRPCRoute service/method matching tests
  • Mixed HTTPRoute + GRPCRoute on same Gateway
  • DNSPolicy/TLSPolicy verification with Gateway having attached GRPCRoutes

Tasks

  • GRPCRoute class implements GatewayRoute interface
  • Route factory method selects correct route class based on parametrization
  • route, backend, and client fixtures support GRPCRoute switching
  • All baseline smoke tests pass with GRPCRoute parametrization
  • Extension policy baseline tests (TelemetryPolicy, PlanPolicy, OIDCPolicy) pass with GRPCRoute parametrization
  • GRPCRoute sectionName targeting tests added
  • GRPCRoute-specific tests added (service/method matching on grpcroute, mixed routes)

Dependencies

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Test caseNew test caseenhancementImprovement to existing test

    Type

    No type

    Projects

    Status

    🆕 New

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions