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

tests/k8s.sh: Fix iperf server setup #71

Merged
merged 1 commit into from
Oct 8, 2023
Merged
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
22 changes: 11 additions & 11 deletions tests/k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,38 @@ function test_k8s {
kubectl wait --for=condition=ready pod/gwctl

# install iperf3 and jq
kubectl exec -it gwctl -- apk add iperf3 jq
kubectl exec -i gwctl -- apk add iperf3 jq

# start iperf3 server
kubectl exec -it gwctl -- iperf3 -s -D -p 1234
kubectl exec -i gwctl -- iperf3 -s -D -p 1234

# expose iperf3 server
kubectl expose pod gwctl --name=foo --port=80 --target-port=1234

# wait for API server to come up
kubectl exec -it gwctl -- timeout 30 sh -c 'until gwctl get peer; do sleep 0.1; done > /dev/null 2>&1'
kubectl exec -i gwctl -- timeout 30 sh -c 'until gwctl get peer; do sleep 0.1; done > /dev/null 2>&1'

# export iperf server
kubectl exec -it gwctl -- gwctl create export --name foo --host foo --port 80
kubectl exec -i gwctl -- gwctl create export --name foo --host foo --port 80

# import
kubectl exec -it gwctl -- gwctl create peer --host cl-dataplane --port 443 --name peer1
kubectl exec -it gwctl -- gwctl create import --name foo --host bla --port 9999
kubectl exec -it gwctl -- gwctl create binding --import foo --peer peer1
kubectl exec -i gwctl -- gwctl create peer --host cl-dataplane --port 443 --name peer1
kubectl exec -i gwctl -- gwctl create import --name foo --host bla --port 9999
kubectl exec -i gwctl -- gwctl create binding --import foo --peer peer1

# get imported service port
PORT=$(kubectl exec -it gwctl -- /bin/bash -c "gwctl get import --name foo | jq '.Status.Listener.Port' | tr -d '\n'")
PORT=$(kubectl exec -i gwctl -- /bin/bash -c "gwctl get import --name foo | jq '.Status.Listener.Port' | tr -d '\n'")

# expose imported service (TODO: remove this when controlplane automatically creates a service)
kubectl expose deployment cl-dataplane --name=bla --port=9999 --target-port=$PORT

# wait for imported service socket to come up
kubectl exec -it gwctl -- timeout 30 sh -c 'until nc -z $0 $1; do sleep 0.1; done' bla 9999
kubectl exec -i gwctl -- timeout 30 sh -c 'until nc -z $0 $1; do sleep 0.1; done' bla 9999
# wait for iperf server to come up
kubectl exec -it gwctl -- timeout 30 sh -c 'until nc -z $0 $1; do sleep 0.1; done' gwctl 1234
kubectl exec -i gwctl -- timeout 30 sh -c 'until nc -z $0 $1; do sleep 0.1; done' gwctl 1234

# run iperf client
kubectl exec -it gwctl -- iperf3 -c bla -p 9999 -t 1
kubectl exec -i gwctl -- iperf3 -c bla -p 9999 -t 1
}

cd $TEST_DIR
Expand Down
Loading