Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
framework.xds_url_map_testcase.XdsUrlMapTestCase Class Reference
Inheritance diagram for framework.xds_url_map_testcase.XdsUrlMapTestCase:
Inheritance graph
[legend]

Public Member Functions

None assertNumEndpoints (self, DumpedXdsConfig xds_config, int k)
 
None assertRpcStatusCode (self, XdsTestClient test_client, *Iterable[ExpectedResult] expected, int length, float tolerance)
 
def hostname (cls)
 
def path_matcher_name (cls)
 
None rpc_distribution_validate (self, XdsTestClient test_client)
 
None run (self, unittest.TestResult result=None)
 
def setUpClass (cls)
 
def tearDownClass (cls)
 
def test_client_config (self)
 
def test_rpc_distribution (self)
 
None xds_config_validate (self, DumpedXdsConfig xds_config)
 
- Public Member Functions inherited from framework.xds_url_map_testcase._MetaXdsUrlMapTestCase
Any __new__ (cls, str name, Iterable[Any] bases, Mapping[str, Any] attrs)
 

Static Public Member Functions

Tuple[str, str] client_init_config (str rpc, str metadata)
 
RpcDistributionStats configure_and_send (XdsTestClient test_client, *Iterable[str] rpc_types, Optional[Iterable[Tuple[str, str, str]]] metadata=None, Optional[int] app_timeout=None, int num_rpcs)
 
bool is_supported (skips.TestConfig config)
 
Tuple[HostRule, PathMatcherurl_map_change (HostRule host_rule, PathMatcher path_matcher)
 

Public Attributes

 finished_test_cases
 
 test_client
 
 test_client_runner
 

Private Member Functions

def _fetch_and_check_xds_config (self)
 

Private Attributes

 _xds_json_config
 

Detailed Description

XdsUrlMapTestCase is the base class for urlMap related tests.

The subclass is expected to implement 3 methods:

- url_map_change: Updates the urlMap components for this test case
- xds_config_validate: Validates if the client received legit xDS configs
- rpc_distribution_validate: Validates if the routing behavior is correct

Definition at line 239 of file xds_url_map_testcase.py.

Member Function Documentation

◆ _fetch_and_check_xds_config()

def framework.xds_url_map_testcase.XdsUrlMapTestCase._fetch_and_check_xds_config (   self)
private

Definition at line 367 of file xds_url_map_testcase.py.

◆ assertNumEndpoints()

None framework.xds_url_map_testcase.XdsUrlMapTestCase.assertNumEndpoints (   self,
DumpedXdsConfig  xds_config,
int  k 
)

Definition at line 429 of file xds_url_map_testcase.py.

◆ assertRpcStatusCode()

None framework.xds_url_map_testcase.XdsUrlMapTestCase.assertRpcStatusCode (   self,
XdsTestClient  test_client,
*Iterable[ExpectedResult expected,
int  length,
float  tolerance 
)
Assert the distribution of RPC statuses over a period of time.

Definition at line 435 of file xds_url_map_testcase.py.

◆ client_init_config()

Tuple[str, str] framework.xds_url_map_testcase.XdsUrlMapTestCase.client_init_config ( str  rpc,
str  metadata 
)
static
Updates the initial RPC configs for this test case.

Each test case will start a test client. The client takes RPC configs
and starts to send RPCs immediately. The config returned by this
function will be used to replace the default configs.

The default configs are passed in as arguments, so this method can
modify part of them.

Args:
    rpc: The default rpc config, specifying RPCs to send, format
    'UnaryCall,EmptyCall'
    metadata: The metadata config, specifying metadata to send with each
    RPC, format 'EmptyCall:key1:value1,UnaryCall:key2:value2'.

Returns:
    A tuple contains the updated rpc and metadata config.

Definition at line 260 of file xds_url_map_testcase.py.

◆ configure_and_send()

RpcDistributionStats framework.xds_url_map_testcase.XdsUrlMapTestCase.configure_and_send ( XdsTestClient  test_client,
*Iterable[str]  rpc_types,
Optional[Iterable[Tuple[str, str, str]]]   metadata = None,
Optional[int]   app_timeout = None,
int  num_rpcs 
)
static

Definition at line 410 of file xds_url_map_testcase.py.

◆ hostname()

def framework.xds_url_map_testcase.XdsUrlMapTestCase.hostname (   cls)

Definition at line 322 of file xds_url_map_testcase.py.

◆ is_supported()

bool framework.xds_url_map_testcase.XdsUrlMapTestCase.is_supported ( skips.TestConfig  config)
static
Allow the test case to decide whether it supports the given config.

Returns:
  A bool indicates if the given config is supported.

Definition at line 250 of file xds_url_map_testcase.py.

◆ path_matcher_name()

def framework.xds_url_map_testcase.XdsUrlMapTestCase.path_matcher_name (   cls)

Definition at line 327 of file xds_url_map_testcase.py.

◆ rpc_distribution_validate()

None framework.xds_url_map_testcase.XdsUrlMapTestCase.rpc_distribution_validate (   self,
XdsTestClient  test_client 
)
Validates the routing behavior, if any is wrong, raise.

Args:
    test_client: A XdsTestClient instance for all sorts of end2end testing.

Definition at line 314 of file xds_url_map_testcase.py.

◆ run()

None framework.xds_url_map_testcase.XdsUrlMapTestCase.run (   self,
unittest.TestResult   result = None 
)
Abort this test case if CSDS check is failed.

This prevents the test runner to waste time on RPC distribution test,
and yields clearer signal.

Definition at line 380 of file xds_url_map_testcase.py.

◆ setUpClass()

def framework.xds_url_map_testcase.XdsUrlMapTestCase.setUpClass (   cls)

Definition at line 332 of file xds_url_map_testcase.py.

◆ tearDownClass()

def framework.xds_url_map_testcase.XdsUrlMapTestCase.tearDownClass (   cls)

Definition at line 360 of file xds_url_map_testcase.py.

◆ test_client_config()

def framework.xds_url_map_testcase.XdsUrlMapTestCase.test_client_config (   self)

Definition at line 391 of file xds_url_map_testcase.py.

◆ test_rpc_distribution()

def framework.xds_url_map_testcase.XdsUrlMapTestCase.test_rpc_distribution (   self)

Definition at line 406 of file xds_url_map_testcase.py.

◆ url_map_change()

Tuple[HostRule, PathMatcher] framework.xds_url_map_testcase.XdsUrlMapTestCase.url_map_change ( HostRule  host_rule,
PathMatcher  path_matcher 
)
static
Updates the dedicated urlMap components for this test case.

Each test case will have a dedicated HostRule, where the hostname is
generated from the test case name. The HostRule will be linked to a
PathMatcher, where stores the routing logic.

Args:
    host_rule: A HostRule GCP resource as a JSON dict.
    path_matcher: A PathMatcher GCP resource as a JSON dict.

Returns:
    A tuple contains the updated version of given HostRule and
    PathMatcher.

Definition at line 283 of file xds_url_map_testcase.py.

◆ xds_config_validate()

None framework.xds_url_map_testcase.XdsUrlMapTestCase.xds_config_validate (   self,
DumpedXdsConfig  xds_config 
)
Validates received xDS config, if anything is wrong, raise.

This stage only ends when the control plane failed to send a valid
config within a given time range, like 600s.

Args:
    xds_config: A DumpedXdsConfig instance can be used as a JSON dict,
      but also provides helper fields for commonly checked xDS config.

Definition at line 302 of file xds_url_map_testcase.py.

Member Data Documentation

◆ _xds_json_config

framework.xds_url_map_testcase.XdsUrlMapTestCase._xds_json_config
private

Definition at line 370 of file xds_url_map_testcase.py.

◆ finished_test_cases

framework.xds_url_map_testcase.XdsUrlMapTestCase.finished_test_cases

Definition at line 363 of file xds_url_map_testcase.py.

◆ test_client

framework.xds_url_map_testcase.XdsUrlMapTestCase.test_client

Definition at line 352 of file xds_url_map_testcase.py.

◆ test_client_runner

framework.xds_url_map_testcase.XdsUrlMapTestCase.test_client_runner

Definition at line 347 of file xds_url_map_testcase.py.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:10