Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dualstack test case #108

Merged
merged 31 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
46f6136
Dualstack test using address_type
larry-safran Jul 23, 2024
024b4b1
Fix testcase
larry-safran Jul 24, 2024
45e8d81
Dualstack test using address_type
larry-safran Jul 23, 2024
1ac3232
checkpoint
larry-safran Jul 25, 2024
04bf57e
reformatted files to make ci happy
larry-safran Jul 25, 2024
0e679b3
Skip creating ipv6 server
larry-safran Jul 26, 2024
3818024
black autoformat
sergiitk Jul 26, 2024
76f2755
isort autoformat
sergiitk Jul 26, 2024
bd7ab45
revert unneeded changes
sergiitk Jul 26, 2024
cf5e49a
fix the issue with not reusing the service from the first runner
sergiitk Jul 26, 2024
1988d21
k8s runner: allow to override app selector label used in the service
sergiitk Jul 26, 2024
35e5bc6
create ipv6 deployment and runner
sergiitk Jul 26, 2024
2dab4e9
Add second IPv6 address range to firewall rule
larry-safran Jul 29, 2024
af86435
Revert "Add second IPv6 address range to firewall rule"
larry-safran Jul 29, 2024
d3dd99d
Remove wait for backends to be health since it will never happen with…
larry-safran Jul 29, 2024
c4dbbf2
Add needed flags to dualstack cfg (without compute_api_version=v1beta…
larry-safran Jul 29, 2024
e927382
cleanup
larry-safran Jul 30, 2024
971ca0c
have client_runner force cleanup namespace when force_cleanup is spec…
larry-safran Jul 31, 2024
9ea45c0
Make black-check happy
larry-safran Jul 31, 2024
27fc0d6
grr
larry-safran Jul 31, 2024
47b7d8f
Address code review comments
larry-safran Jul 31, 2024
9824b48
Address code review comments
larry-safran Jul 31, 2024
ebd23e5
Update kubernetes-manifests/server.deployment.yaml
larry-safran Jul 31, 2024
0fd60d9
Address code review comments
larry-safran Jul 31, 2024
652be92
Merge remote-tracking branch 'origin/dualstack_test' into dualstack_test
larry-safran Jul 31, 2024
085ffa7
Update tests/dualstack_test.py
larry-safran Jul 31, 2024
d6587f2
Add is_supported function to limit it to CPP, PYTHON and JAVA version…
larry-safran Jul 31, 2024
0293959
Add TODO about updating Java canonical
larry-safran Jul 31, 2024
a42e4b5
lint
larry-safran Jul 31, 2024
704d52e
Update tests/dualstack_test.py
larry-safran Jul 31, 2024
55be4bc
grrr
larry-safran Jul 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/common-dualstack.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
--resource_prefix=psm-ds
--enable_dualstack
--noenable_workload_identity
--compute_api_version=v1beta
--network=dualstack

# TODO remove when ipAddressSelectionPolicy is available in compute v1
--compute_api_version=v1beta
2 changes: 1 addition & 1 deletion kubernetes-manifests/server.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
- name: ${deployment_name}
image: ${image_name}
imagePullPolicy: Always
% if address_type != "ipv6":
% if address_type != "ipv6": # TODO test without this when ipv6 HC fw rules are in place
larry-safran marked this conversation as resolved.
Show resolved Hide resolved
startupProbe:
tcpSocket:
port: ${test_port}
Expand Down
63 changes: 29 additions & 34 deletions tests/dualstack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime as dt
import logging
from typing import Final, List
from typing import Final

from absl import flags
from absl.testing import absltest
Expand All @@ -29,6 +30,8 @@
_XdsTestServer = xds_k8s_testcase.XdsTestServer
_XdsTestClient = xds_k8s_testcase.XdsTestClient
_KubernetesServerRunner = k8s_xds_server_runner.KubernetesServerRunner
v4_server_runner: k8s_xds_server_runner.KubernetesServerRunner = None
v6_server_runner: k8s_xds_server_runner.KubernetesServerRunner = None
sergiitk marked this conversation as resolved.
Show resolved Hide resolved
_Lang = skips.Lang

_SERVERS_APP_LABEL: Final[str] = "psm-interop-dualstack"
Expand All @@ -43,7 +46,7 @@ def setUpClass(cls):
cls.server_image = xds_k8s_flags.SERVER_IMAGE_CANONICAL.value
larry-safran marked this conversation as resolved.
Show resolved Hide resolved

def setUp(self):
self.enable_dualstack = True
assert self.enable_dualstack == True
sergiitk marked this conversation as resolved.
Show resolved Hide resolved
super().setUp()
runner_args = dict(
image_name=self.server_image,
Expand All @@ -61,33 +64,41 @@ def setUp(self):
enable_workload_identity=self.enable_workload_identity,
)

k8s_namespace = self.server_runner.k8s_namespace
# Replaces self.server_runner initiated in self.initKubernetesServerRunner().
self.server_runner = _KubernetesServerRunner(
self.server_runner.k8s_namespace,
k8s_namespace,
deployment_name=self.server_name,
**runner_args,
)
self.v4_server_runner = _KubernetesServerRunner(
self.server_runner.k8s_namespace,
k8s_namespace,
deployment_name=self.server_name + "-v4",
service_name=self.server_runner.service_name,
**runner_args,
)
self.v6_server_runner = _KubernetesServerRunner(
self.server_runner.k8s_namespace,
k8s_namespace,
deployment_name=self.server_name + "-v6",
service_name=self.server_runner.service_name,
**runner_args,
)

def cleanup(self):
super().cleanup()
if hasattr(self, "v4_server_runner"):
self.td.cleanup(force=self.force_cleanup)
self.client_runner.cleanup(
force=self.force_cleanup, force_namespace=self.force_cleanup
)
self.server_runner.cleanup(
force=self.force_cleanup, force_namespace=False
)
if self.v4_server_runner:
self.v4_server_runner.cleanup(
force=self.force_cleanup, force_namespace=self.force_cleanup
force=self.force_cleanup, force_namespace=False
)
if hasattr(self, "v6_server_runner"):
if self.v6_server_runner:
self.v6_server_runner.cleanup(
force=self.force_cleanup, force_namespace=self.force_cleanup
force=self.force_cleanup, force_namespace=True
)

def test_dual_stack(self) -> None:
larry-safran marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -102,8 +113,8 @@ def test_dual_stack(self) -> None:
self.server_xds_host, self.server_xds_port
)

test_servers: List[_XdsTestServer] = []
with self.subTest("03_start_test_server-default"):
test_servers: list[_XdsTestServer] = []
with self.subTest("03_start_test_server-dualstack"):
test_servers.append(
self.startTestServers(
server_runner=self.server_runner,
Expand Down Expand Up @@ -152,29 +163,13 @@ def test_dual_stack(self) -> None:
with self.subTest("07_test_server_received_rpcs_from_test_client"):
self.assertSuccessfulRpcs(test_client)

with self.subTest("08_round_robin"):
num_rpcs = 100
expected_rpcs_per_replica = num_rpcs / len(test_servers)

rpcs_by_peer = self.getClientRpcStats(
test_client, num_rpcs
).rpcs_by_peer
total_requests_received = sum(rpcs_by_peer[x] for x in rpcs_by_peer)
self.assertEqual(
total_requests_received, num_rpcs, "Wrong number of RPCS"
with self.subTest("08_confirm_all_servers_receive_traffic"):
self.assertRpcsEventuallyGoToGivenServers(
test_client,
test_servers,
retry_timeout=dt.timedelta(minutes=5),
retry_wait=dt.timedelta(seconds=5),
)
for server in test_servers:
hostname = server.hostname
self.assertIn(
hostname,
rpcs_by_peer,
f"Server {hostname} did not receive RPCs",
)
self.assertGreater(
rpcs_by_peer[hostname],
3,
f"Insufficient RPCs for server {hostname}",
)


if __name__ == "__main__":
Expand Down
Loading