Skip to content

Commit

Permalink
[chore] Fix loadtest setup script (#33860)
Browse files Browse the repository at this point in the history
**Description:**
This PR fixes the load test pipeline which was broken for a while.
The array of tests was not iterated over correctly in
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/.github/workflows/scripts/setup_e2e_tests.sh
and the first iteration of the loop resulted in the whole array being
added to the matrix instead of just the first entry of the array.

I introduced a different way to read in the array of tests at the start
of the setup bash script, which works now.
[source for the solution](https://stackoverflow.com/a/10586169)

**Link to tracking Issue:** Fixes #33577

**Testing:** Tested successfully on my personal fork. This is a [link to
a load test
run](https://github.com/mowies/opentelemetry-collector-contrib/actions/runs/9761599340)
where the matrix is correctly parsed by github actions.

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
  • Loading branch information
mowies authored Jul 2, 2024
1 parent 24a75b5 commit cce9800
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/scripts/setup_e2e_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
# SPDX-License-Identifier: Apache-2.0

TESTS="$(make -s -C testbed list-tests | xargs echo|sed 's/ /|/g')"
TESTS=("${TESTS//|/ }")
IFS='|' read -r -a TEST_ARRAY <<< "$TESTS"

MATRIX="{\"include\":["
curr=""
for i in "${!TESTS[@]}"; do
if (( i > 0 && i % 2 == 0 )); then
curr+="|${TESTS[$i]}"
else
for i in "${!TEST_ARRAY[@]}"; do
if (( i > 0 && i % 2 == 0 )); then
curr+="|${TEST_ARRAY[$i]}"
else
if [ -n "$curr" ] && (( i>1 )); then
MATRIX+=",{\"test\":\"$curr\"}"
MATRIX+=",{\"test\":\"$curr\"}"
elif [ -n "$curr" ]; then
MATRIX+="{\"test\":\"$curr\"}"
MATRIX+="{\"test\":\"$curr\"}"
fi
curr="${TESTS[$i]}"
fi
curr="${TEST_ARRAY[$i]}"
fi
done
MATRIX+=",{\"test\":\"$curr\"}]}"
echo "loadtest_matrix=$MATRIX" >> "$GITHUB_OUTPUT"

0 comments on commit cce9800

Please sign in to comment.