app_net_test.py
Go to the documentation of this file.
1 # Copyright 2021 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 import logging
15 
16 from absl import flags
17 from absl.testing import absltest
18 
19 from framework import xds_k8s_testcase
20 
21 logger = logging.getLogger(__name__)
22 flags.adopt_module_key_flags(xds_k8s_testcase)
23 
24 _XdsTestServer = xds_k8s_testcase.XdsTestServer
25 _XdsTestClient = xds_k8s_testcase.XdsTestClient
26 
27 
28 class AppNetTest(xds_k8s_testcase.AppNetXdsKubernetesTestCase):
29 
30  def test_ping_pong(self):
31  with self.subTest('0_create_health_check'):
32  self.td.create_health_check()
33 
34  with self.subTest('1_create_backend_service'):
35  self.td.create_backend_service()
36 
37  with self.subTest('2_create_mesh'):
38  self.td.create_mesh()
39 
40  with self.subTest('3_create_grpc_route'):
41  self.td.create_grpc_route(self.server_xds_host,
42  self.server_xds_port)
43 
44  test_server: _XdsTestServer
45  with self.subTest('4_start_test_server'):
46  test_server = self.startTestServers(replica_count=1)[0]
47 
48  with self.subTest('5_setup_server_backends'):
49  self.setupServerBackends()
50 
51  test_client: _XdsTestClient
52  with self.subTest('6_start_test_client'):
53  test_client = self.startTestClient(test_server,
54  config_mesh=self.td.mesh.name)
55 
56  with self.subTest('7_assert_xds_config_exists'):
57  self.assertXdsConfigExists(test_client)
58 
59  with self.subTest('8_assert_successful_rpcs'):
60  self.assertSuccessfulRpcs(test_client)
61 
62 
63 if __name__ == '__main__':
64  absltest.main(failfast=True)
tests.app_net_test.AppNetTest
Definition: app_net_test.py:28
tests.app_net_test.AppNetTest.test_ping_pong
def test_ping_pong(self)
Definition: app_net_test.py:30
run_xds_tests.create_health_check
def create_health_check(gcp, name)
Definition: run_xds_tests.py:2515


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:31