Skip to content

Commit 301503f

Browse files
authored
[Test] Use local devfile.yaml for workspace creation in load-test script (#22855)
1 parent fe3c6cf commit 301503f

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
kind: DevWorkspace
2+
apiVersion: workspace.devfile.io/v1alpha2
3+
metadata:
4+
name: code-latest
5+
spec:
6+
started: true
7+
template:
8+
components:
9+
- name: dev
10+
container:
11+
image: quay.io/devfile/universal-developer-image:latest
12+
contributions:
13+
- name: che-code
14+
uri: https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml
15+
components:
16+
- name: che-code-runtime-description
17+
container:
18+
env:
19+
- name: CODE_HOST
20+
value: 0.0.0.0

tests/performance/load-tests/load-test.sh

+13-20
Original file line numberDiff line numberDiff line change
@@ -40,38 +40,30 @@ if [ -z $COMPLETITIONS_COUNT ]; then
4040
export COMPLETITIONS_COUNT=3
4141
fi
4242

43-
# Checkout to user devspaces namespace
44-
export userName=$(kubectl config view --minify -o jsonpath='{.users[0].name}' | sed 's|/.*||')
45-
kubectl config set-context --current --namespace=$userName-devspaces
46-
4743
# Delete all dw and dwt objects from test namespace
4844
cleanup
4945

5046
# Delete logs
51-
rm dw* || true
47+
rm dw* || true > /dev/null
5248

53-
# Get Openshift DevSpaces url and path to sample devfile yaml from devfile-registry
54-
export devworkspaceUrl=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' | sed 's/:6443//' | sed 's/api/devspaces.apps/')
55-
export testDevfilePath="devfile-registry/devfiles/TP__cpp__c-plus-plus/devworkspace-che-code-latest.yaml"
5649

57-
echo "Download the devfile"
58-
curl --insecure "$devworkspaceUrl/$testDevfilePath" -o devfile.yaml
50+
for ((i=1; i<=$COMPLETITIONS_COUNT; i++)); do
51+
cat devfile.yaml | sed "0,/name: code-latest/s//name: dw$i/" | kubectl apply -f - &
52+
done
5953

60-
echo "Start workspaces from sample devfile"
61-
csplit devfile.yaml /---/
62-
mv xx00 dwt.yaml
63-
mv xx01 dw.yaml
64-
kubectl apply -f dwt.yaml
54+
wait
6555

6656
for ((i=1; i<=$COMPLETITIONS_COUNT; i++)); do
67-
cat dw.yaml | sed "0,/name: cpp/s//name: dw$i/" | kubectl apply -f -
57+
kubectl wait --for=condition=Ready "dw/dw$i" --timeout=180s || true &
6858
done
6959

60+
wait
61+
7062
total_time=0
7163
succeeded=0
7264
echo "Wait for all workspaces are started and calculate average workspaces starting time"
7365
for ((i=1; i<=$COMPLETITIONS_COUNT; i++)); do
74-
if kubectl wait --for=condition=Ready "dw/dw$i" --timeout=120s; then
66+
if [ "$(kubectl get dw dw$i --template='{{.status.phase}}')" == "Running" ]; then
7567
start_time=$(kubectl get dw dw$i --template='{{range .status.conditions}}{{if eq .type "Started"}}{{.lastTransitionTime}}{{end}}{{end}}')
7668
end_time=$(kubectl get dw dw$i --template='{{range .status.conditions}}{{if eq .type "Ready"}}{{.lastTransitionTime}}{{end}}{{end}}')
7769
start_timestamp=$(date -d $start_time +%s)
@@ -84,13 +76,14 @@ for ((i=1; i<=$COMPLETITIONS_COUNT; i++)); do
8476
else
8577
print_error "Timeout waiting for dw$i to become ready or an error occurred."
8678
kubectl describe dw dw$i > dw$i-log.log
87-
kubectl logs $(oc get dw dw$i --template='{{.status.devworkspaceId}}') > dw$i-pod.log || true
88-
fi
79+
kubectl logs $(kubectl get dw dw$i --template='{{.status.devworkspaceId}}') > dw$i-pod.log || true
80+
fi
8981
done
9082

83+
wait
84+
9185
print "==================== Test results ===================="
9286
print "Average workspace starting time for $succeeded workspaces from $COMPLETITIONS_COUNT started: $((total_time / succeeded)) seconds"
9387
print "$((COMPLETITIONS_COUNT - succeeded)) workspaces failed. See failed workspace pod logs in the current folder for details."
9488

9589
trap cleanup ERR EXIT
96-

0 commit comments

Comments
 (0)