Skip to content

Commit

Permalink
Add Node interop server (#151)
Browse files Browse the repository at this point in the history
This modifies the driver to use the Node interop server implemented in
grpc/grpc-node#2897 whenever possible. Test
runs:

- [x]
[grpc/node/master/xds_k8s_lb](https://source.cloud.google.com/results/invocations/5eda22ed-1bf6-4a9e-b7ee-7da93c2dfa09)
- [ ]
~[grpc/node/master/psm-dualstack](https://source.cloud.google.com/results/invocations/407b7ba1-ce14-4e3d-a025-b9219fffb3e1)~
  • Loading branch information
murgatroid99 authored Feb 5, 2025
1 parent 54f9282 commit 7b19947
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
10 changes: 1 addition & 9 deletions .kokoro/psm_interop_kokoro_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,6 @@ psm::run::test() {
# Some test suites have canonical server image configured in the flagfiles.
if [[ -z "${SERVER_IMAGE_USE_CANONICAL}" ]]; then
PSM_TEST_FLAGS+=("--server_image=${SERVER_IMAGE_NAME}:${GIT_COMMIT}")
elif [[ "${GRPC_LANGUAGE}" == "node" ]]; then
# TODO(b/261911148): To be replaced with --server_image_use_canonical when implemented.
PSM_TEST_FLAGS+=("--server_image=us-docker.pkg.dev/grpc-testing/psm-interop/java-server:canonical-v1.66")
fi

# So far, only LB test uses secondary GKE cluster.
Expand Down Expand Up @@ -535,15 +532,10 @@ psm::setup::docker_image_names() {
SERVER_IMAGE_USE_CANONICAL=""

case "${language}" in
java | cpp | python | go)
java | cpp | python | go | node)
CLIENT_IMAGE_NAME="${DOCKER_REGISTRY}/grpc-testing/psm-interop/${GRPC_LANGUAGE}-client"
SERVER_IMAGE_NAME="${DOCKER_REGISTRY}/grpc-testing/psm-interop/${GRPC_LANGUAGE}-server"
;;
node)
CLIENT_IMAGE_NAME="${DOCKER_REGISTRY}/grpc-testing/psm-interop/${GRPC_LANGUAGE}-client"
SERVER_IMAGE_NAME=""
SERVER_IMAGE_USE_CANONICAL="1"
;;
*)
psm::tools::log "Unknown Language: ${1}"
exit 1
Expand Down
7 changes: 7 additions & 0 deletions framework/xds_k8s_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ def setUpClass(cls):
# Other
cls.yaml_highlighter = framework.helpers.highlighter.HighlighterYaml()

# The Node server was added in version 1.13.x
if (
cls.lang_spec.client_lang == skips.Lang.NODE
and not cls.lang_spec.version_gte("v1.13.x")
):
cls.server_image = xds_k8s_flags.SERVER_IMAGE_CANONICAL.value

@classmethod
def _pretty_accumulated_stats(
cls,
Expand Down
4 changes: 2 additions & 2 deletions tests/circuit_breaking_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def setUpClass(cls):
https://github.com/grpc/grpc/blob/master/doc/xds-test-descriptions.md#server
"""
super().setUpClass()
if cls.lang_spec.client_lang is not _Lang.JAVA:
# gRPC C++, go, python and node fallback to the gRPC Java.
if cls.lang_spec.client_lang is not _Lang.JAVA | _Lang.NODE:
# gRPC C++, go, and python fallback to the gRPC Java.
# TODO(https://github.com/grpc/grpc-go/issues/6288): use go server.
# TODO(https://github.com/grpc/grpc/issues/33134): use python server.
cls.server_image = xds_k8s_flags.SERVER_IMAGE_CANONICAL.value
Expand Down
5 changes: 3 additions & 2 deletions tests/custom_lb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ def setUpClass(cls):

# gRPC Java implemented server "error-code-" rpc-behavior in v1.47.x.
# gRPC CPP implemented rpc-behavior in the same version, as custom_lb.
if client_lang in _Lang.JAVA | _Lang.CPP:
# gRPC Node implemented the server in 1.13.x
if client_lang in _Lang.JAVA | _Lang.CPP | _Lang.NODE:
return

# gRPC Go implemented server "error-code-" rpc-behavior in v1.59.x,
# see https://github.com/grpc/grpc-go/pull/6575.
if client_lang == _Lang.GO and cls.lang_spec.version_gte("v1.59.x"):
return

# gRPC go, python and node fallback to the gRPC Java.
# gRPC go and python fallback to the gRPC Java.
# TODO(https://github.com/grpc/grpc/issues/33134): use python server.
cls.server_image = xds_k8s_flags.SERVER_IMAGE_CANONICAL.value

Expand Down
2 changes: 1 addition & 1 deletion tests/dualstack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setUpClass(cls):
# TODO: when Java 1.66 is available, make sure the canonical server is switched to it so
# that we have all features we need for the dualstack test
super().setUpClass()
if cls.lang_spec.client_lang is not _Lang.JAVA:
if cls.lang_spec.client_lang not in _Lang.JAVA | _Lang.NODE:
cls.server_image = xds_k8s_flags.SERVER_IMAGE_CANONICAL.value

def setUp(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/outlier_detection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def setUpClass(cls):
client_lang = cls.lang_spec.client_lang

# gRPC Java implemented server "error-code-" rpc-behavior in v1.47.x.
if client_lang == _Lang.JAVA:
# gRPC Node implemented the server in v1.13.x
if client_lang == _Lang.JAVA | _Lang.NODE:
return

# gRPC CPP implemented server "hostname" rpc-behavior in v1.57.x,
Expand All @@ -69,7 +70,7 @@ def setUpClass(cls):
if client_lang == _Lang.GO and cls.lang_spec.version_gte("v1.59.x"):
return

# gRPC go, python and node fallback to the gRPC Java.
# gRPC go and python fallback to the gRPC Java.
# TODO(https://github.com/grpc/grpc-go/issues/6288): use go server.
# TODO(https://github.com/grpc/grpc/issues/33134): use python server.
cls.server_image = xds_k8s_flags.SERVER_IMAGE_CANONICAL.value
Expand Down

0 comments on commit 7b19947

Please sign in to comment.