mirror of https://github.com/hashicorp/consul
Backport of ci: fix test splits that have less test packages than runner count from hanging into release/1.14.x (#17084)
* no-op commit due to failed cherry-picking * manual backport * fix --------- Co-authored-by: temp <temp@hashicorp.com> Co-authored-by: John Murret <john.murret@hashicorp.com>backport/loshz-patch-1/friendly-touched-killdeer
parent
6d02197557
commit
3342eeb73c
|
@ -155,17 +155,24 @@ jobs:
|
|||
# multiplied by 8 based on these values:
|
||||
# envoy-version: ["1.22.11", "1.23.8", "1.24.6", "1.25.4"]
|
||||
# xds-target: ["server", "client"]
|
||||
TOTAL_RUNNERS: 3
|
||||
TOTAL_RUNNERS: 4
|
||||
JQ_SLICER: '[ inputs ] | [_nwise(length / $runnercount | floor)]'
|
||||
run: |
|
||||
NUM_RUNNERS=$TOTAL_RUNNERS
|
||||
NUM_DIRS=$(find ./test/integration/connect/envoy -maxdepth 1 -type d | wc -l)
|
||||
if [ "$NUM_DIRS" -lt "$NUM_RUNNERS" ]; then
|
||||
echo "TOTAL_RUNNERS is larger than the number of tests/packages to split."
|
||||
NUM_RUNNERS=$NUM_DIRS
|
||||
fi
|
||||
# fix issue where test splitting calculation generates 1 more split than TOTAL_RUNNERS.
|
||||
NUM_RUNNERS=$((NUM_RUNNERS-1))
|
||||
{
|
||||
echo -n "envoy-matrix="
|
||||
find ./test/integration/connect/envoy -maxdepth 1 -type d -print0 \
|
||||
| xargs -0 -n 1 basename \
|
||||
| jq --raw-input --argjson runnercount "$TOTAL_RUNNERS" "$JQ_SLICER" \
|
||||
| jq --raw-input --argjson runnercount "$NUM_RUNNERS" "$JQ_SLICER" \
|
||||
| jq --compact-output 'map(join("|"))'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
cat "$GITHUB_OUTPUT"
|
||||
|
||||
envoy-integration-test:
|
||||
runs-on: ${{ fromJSON(needs.setup.outputs.compute-xl) }}
|
||||
|
@ -261,18 +268,29 @@ jobs:
|
|||
- name: Generate Compatibility Job Matrix
|
||||
id: set-matrix
|
||||
env:
|
||||
TOTAL_RUNNERS: 3
|
||||
TOTAL_RUNNERS: 6
|
||||
JQ_SLICER: '[ inputs ] | [_nwise(length / $runnercount | floor)]'
|
||||
run: |
|
||||
cd ./test/integration/consul-container
|
||||
NUM_RUNNERS=$TOTAL_RUNNERS
|
||||
NUM_DIRS=$(find ./test -maxdepth 2 -type d | wc -l)
|
||||
|
||||
#remove on for the top level directory
|
||||
NUM_DIRS=$((NUM_DIRS-1))
|
||||
|
||||
if [ "$NUM_DIRS" -lt "$NUM_RUNNERS" ]; then
|
||||
echo "TOTAL_RUNNERS is larger than the number of tests/packages to split."
|
||||
NUM_RUNNERS=$((NUM_DIRS-1))
|
||||
fi
|
||||
# fix issue where test splitting calculation generates 1 more split than TOTAL_RUNNERS.
|
||||
NUM_RUNNERS=$((NUM_RUNNERS-1))
|
||||
{
|
||||
echo -n "compatibility-matrix="
|
||||
find ./test -maxdepth 2 -type d -print0 | xargs -0 -n 1 \
|
||||
| grep -v util | grep -v upgrade \
|
||||
| jq --raw-input --argjson runnercount "$TOTAL_RUNNERS" "$JQ_SLICER" \
|
||||
| jq --raw-input --argjson runnercount "$NUM_RUNNERS" "$JQ_SLICER" \
|
||||
| jq --compact-output 'map(join(" "))'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
cat "$GITHUB_OUTPUT"
|
||||
compatibility-integration-test:
|
||||
runs-on: ${{ fromJSON(needs.setup.outputs.compute-xl) }}
|
||||
needs:
|
||||
|
@ -359,17 +377,24 @@ jobs:
|
|||
- name: Generate Updgrade Job Matrix
|
||||
id: set-matrix
|
||||
env:
|
||||
TOTAL_RUNNERS: 2
|
||||
TOTAL_RUNNERS: 5
|
||||
JQ_SLICER: '[ inputs ] | [_nwise(length / $runnercount | floor)]'
|
||||
run: |
|
||||
cd ./test/integration/consul-container/test/upgrade
|
||||
NUM_RUNNERS=$TOTAL_RUNNERS
|
||||
NUM_DIRS=$(go test ./... -list=. -json | jq -r '.Output | select (. !=null) | select(. | startswith("Test")) | gsub("[\\n\\t]"; "")' | wc -l)
|
||||
if [ "$NUM_DIRS" -lt "$NUM_RUNNERS" ]; then
|
||||
echo "TOTAL_RUNNERS is larger than the number of tests/packages to split."
|
||||
NUM_RUNNERS=$NUM_DIRS
|
||||
fi
|
||||
# fix issue where test splitting calculation generates 1 more split than TOTAL_RUNNERS.
|
||||
NUM_RUNNERS=$((NUM_RUNNERS-1))
|
||||
{
|
||||
echo -n "upgrade-matrix="
|
||||
go test ./... -list=. -json | jq -r '.Output | select (. !=null) | select(. | startswith("Test")) | gsub("[\\n\\t]"; "")' \
|
||||
| jq --raw-input --argjson runnercount "$TOTAL_RUNNERS" "$JQ_SLICER" \
|
||||
| jq --raw-input --argjson runnercount "$NUM_RUNNERS" "$JQ_SLICER" \
|
||||
| jq --compact-output 'map(join("|"))'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
cat "$GITHUB_OUTPUT"
|
||||
|
||||
upgrade-integration-test:
|
||||
runs-on: ${{ fromJSON(needs.setup.outputs.compute-xl) }}
|
||||
|
|
Loading…
Reference in New Issue