Skip to content

Commit 84f5814

Browse files
committed
test: add multi-node k8s test script for cross-node gRPC transfers
- workspace-tests/tests/k8s_multinode_tests.rs: Rust integration tests using the kube crate, all #[ignore] by default. 5 tests: - Cross-node gRPC transfer (default, 64KB, 4MB chunk sizes) - Transfer integrity with md5 content hash comparison - Multi-replica independent cache verification - test_multinode_k8s.sh: minimal wrapper that builds the Docker image, distributes it via microk8s images import, and runs cargo test - Adds kube ws feature and anyhow to workspace-tests dependencies Signed-off-by: Nicolas 'Pixel' Noble <nicolas@nobis-crew.org>
1 parent 48b393e commit 84f5814

File tree

4 files changed

+750
-0
lines changed

4 files changed

+750
-0
lines changed

Cargo.lock

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test_multinode_k8s.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Build the ModelExpress Docker image, distribute it to all cluster nodes,
6+
# and run the multi-node Kubernetes integration tests.
7+
#
8+
# The actual test logic lives in workspace-tests/tests/k8s_multinode_tests.rs.
9+
# This script only handles image preparation, which can't be done from Rust.
10+
#
11+
# Prerequisites:
12+
# - Docker
13+
# - A multi-node Kubernetes cluster (at least 2 schedulable nodes) with kubeconfig accessible
14+
# - The modelexpress:multinode-test image must be available on all cluster nodes
15+
#
16+
# Image distribution:
17+
# - microk8s: auto-detected, uses `microk8s images import` to distribute to all nodes
18+
# - Other clusters: push the image to your registry and ensure nodes can pull it,
19+
# or use your cluster's image distribution mechanism. Use --skip-build to skip
20+
# the Docker build step if the image is already available.
21+
#
22+
# The tests themselves are cluster-agnostic: they discover nodes dynamically via
23+
# the Kubernetes API and only require standard kubeconfig access.
24+
#
25+
# Usage:
26+
# ./test_multinode_k8s.sh [--skip-build] [-- cargo test args...]
27+
#
28+
# Examples:
29+
# ./test_multinode_k8s.sh # Build + run all tests
30+
# ./test_multinode_k8s.sh --skip-build # Skip image build, just run tests
31+
# ./test_multinode_k8s.sh -- --test cross_node # Run only cross_node tests
32+
33+
set -e
34+
cd "$(dirname "$0")"
35+
36+
SKIP_BUILD=false
37+
CARGO_ARGS=()
38+
39+
while [[ $# -gt 0 ]]; do
40+
case $1 in
41+
--skip-build) SKIP_BUILD=true; shift ;;
42+
--) shift; CARGO_ARGS=("$@"); break ;;
43+
*) CARGO_ARGS=("$@"); break ;;
44+
esac
45+
done
46+
47+
# Step 1: Build and distribute image
48+
if [ "$SKIP_BUILD" = false ]; then
49+
echo "Building Docker image modelexpress:multinode-test..."
50+
docker build -t modelexpress:multinode-test .
51+
52+
if command -v /snap/bin/microk8s &>/dev/null; then
53+
echo "Distributing image to microk8s cluster nodes..."
54+
docker save modelexpress:multinode-test | /snap/bin/microk8s images import -
55+
fi
56+
fi
57+
58+
# Step 2: Run the Rust k8s tests (ignored by default, --ignored enables them)
59+
cargo test --test k8s_multinode_tests -- --ignored "${CARGO_ARGS[@]}"

workspace-tests/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ serde_json = { workspace = true }
2222
tempfile = { workspace = true }
2323
tracing = { workspace = true }
2424
tracing-subscriber = { workspace = true }
25+
kube = { workspace = true, features = ["ws"] }
26+
k8s-openapi = { workspace = true }
27+
anyhow = { workspace = true }
2528

2629
[dev-dependencies]
2730
criterion = { version = "0.6", features = ["html_reports"] }

0 commit comments

Comments
 (0)