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

chore: add network benchmark tool test script and documentation #34222

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions experiment/network-benchmark-test/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Test for Network Benchmark Tool

[This script](./test.sh) verifies the network benchmarks in the [kubernetes/perf-tests](https://github.com/kubernetes/perf-tests) package. It clones the specified fork and branch, runs network benchmark tests against a provided image, and cleans up after execution.

## Usage

Set environment variables as needed:
• FORK_TO_TEST (default: kubernetes/perf-tests)
• BRANCH_TO_TEST (default: master)
• IMAGE_TO_TEST (default: ghcr.io/ritwikranjan/nptest:latest)
• KUBECONFIG (default: ~/.kube/config)

```shell
bash test.sh
```
36 changes: 36 additions & 0 deletions experiment/network-benchmark-test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Copyright 2025 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

FORK_TO_TEST="${FORK_TO_TEST:-kubernetes/perf-tests}"
BRANCH_TO_TEST="${BRANCH_TO_TEST:-master}"
IMAGE_TO_TEST="${IMAGE_TO_TEST:-ghcr.io/ritwikranjan/nptest:latest}"

KUBECONFIG=${KUBECONFIG:-~/.kube/config}

echo "Forking the repository..."
git clone "https://github.com/$FORK_TO_TEST.git"
cd $(basename $FORK_TO_TEST)
git checkout "$BRANCH_TO_TEST"

echo "Navigating to network/benchmarks/netperf directory..."
cd network/benchmarks/netperf
echo "Running netperf test..."
go run launch.go -image=$IMAGE_TO_TEST -kubeConfig=$KUBECONFIG -testFrom=0 -testTo=1 -json

echo "Cleaning up..."
cd ../../../..
rm -rf $(basename $FORK_TO_TEST)
echo "Script execution completed."