@@ -253,11 +253,39 @@ jobs:
253253 name : ${{ env.TEST_RESULTS_ARTIFACT_NAME }}
254254 path : ${{ env.TEST_RESULTS_DIR }}
255255
256+ generate-compatibility-job-matrices :
257+ needs : [setup]
258+ runs-on : ${{ fromJSON(needs.setup.outputs.compute-small) }}
259+ name : Generate Compatibility Job Matrices
260+ outputs :
261+ compatibility-matrix : ${{ steps.set-matrix.outputs.compatibility-matrix }}
262+ steps :
263+ - uses : actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
264+ - name : Generate Compatibility Job Matrix
265+ id : set-matrix
266+ env :
267+ TOTAL_RUNNERS : 5
268+ JQ_SLICER : ' [ inputs ] | [_nwise(length / $runnercount | floor)]'
269+ run : |
270+ cd ./test/integration/consul-container
271+ {
272+ echo -n "compatibility-matrix="
273+ find ./test -maxdepth 2 -type d -print0 | xargs -0 -n 1 \
274+ | grep -v util | grep -v upgrade \
275+ | jq --raw-input --argjson runnercount "$TOTAL_RUNNERS" "$JQ_SLICER" \
276+ | jq --compact-output 'map(join(" "))'
277+ } >> "$GITHUB_OUTPUT"
278+ cat "$GITHUB_OUTPUT"
256279 compatibility-integration-test :
257280 runs-on : ${{ fromJSON(needs.setup.outputs.compute-xl) }}
258281 needs :
259282 - setup
260283 - dev-build
284+ - generate-compatibility-job-matrices
285+ strategy :
286+ fail-fast : false
287+ matrix :
288+ test-cases : ${{ fromJSON(needs.generate-compatibility-job-matrices.outputs.compatibility-matrix) }}
261289 steps :
262290 - uses : actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
263291 - uses : actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
@@ -280,28 +308,32 @@ jobs:
280308
281309 - name : Build consul:local image
282310 run : docker build -t ${{ env.CONSUL_LATEST_IMAGE_NAME }}:local -f ./build-support/docker/Consul-Dev.dockerfile .
311+ - name : Configure GH workaround for ipv6 loopback
312+ if : ${{ !endsWith(github.repository, '-enterprise') }}
313+ run : |
314+ cat /etc/hosts && echo "-----------"
315+ sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6-localhost ip6-loopback/g' /etc/hosts
316+ cat /etc/hosts
283317 - name : Compatibility Integration Tests
284318 run : |
285- cat /etc/hosts && echo "-----------"
286- sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6-localhost ip6-loopback/g' /etc/hosts
287- cat /etc/hosts
288319 mkdir -p "/tmp/test-results"
289320 cd ./test/integration/consul-container
290321 docker run --rm ${{ env.CONSUL_LATEST_IMAGE_NAME }}:local consul version
291- # shellcheck disable=SC2046
322+ echo "Running $(sed 's,|, ,g' <<< "${{ matrix.test-cases }}" |wc -w) subtests"
323+ # shellcheck disable=SC2001
324+ sed 's,|,\n,g' <<< "${{ matrix.test-cases }}"
292325 gotestsum \
293326 --raw-command \
294327 --format=short-verbose \
295328 --debug \
296329 --rerun-fails=3 \
297- --packages="./..." \
298330 -- \
299331 go test \
300332 -p=4 \
301333 -tags "${{ env.GOTAGS }}" \
302334 -timeout=30m \
303335 -json \
304- $(go list ./... | grep -v upgrade) \
336+ "${{ matrix.test-cases }}" \
305337 --target-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
306338 --target-version local \
307339 --latest-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
@@ -320,14 +352,43 @@ jobs:
320352 name : ${{ env.TEST_RESULTS_ARTIFACT_NAME }}
321353 path : ${{ env.TEST_RESULTS_DIR }}
322354
355+ generate-upgrade-job-matrices :
356+ needs : [setup]
357+ runs-on : ${{ fromJSON(needs.setup.outputs.compute-small) }}
358+ name : Generate Upgrade Job Matrices
359+ outputs :
360+ upgrade-matrix : ${{ steps.set-matrix.outputs.upgrade-matrix }}
361+ steps :
362+ - uses : actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
363+ - uses : actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
364+ with :
365+ go-version-file : ' go.mod'
366+ - name : Generate Updgrade Job Matrix
367+ id : set-matrix
368+ env :
369+ TOTAL_RUNNERS : 4
370+ JQ_SLICER : ' [ inputs ] | [_nwise(length / $runnercount | floor)]'
371+ run : |
372+ cd ./test/integration/consul-container/test/upgrade
373+ {
374+ echo -n "upgrade-matrix="
375+ go test ./... -list=. -json | jq -r '.Output | select (. !=null) | select(. | startswith("Test")) | gsub("[\\n\\t]"; "")' \
376+ | jq --raw-input --argjson runnercount "$TOTAL_RUNNERS" "$JQ_SLICER" \
377+ | jq --compact-output 'map(join("|"))'
378+ } >> "$GITHUB_OUTPUT"
379+ cat "$GITHUB_OUTPUT"
380+
323381 upgrade-integration-test :
324382 runs-on : ${{ fromJSON(needs.setup.outputs.compute-xl) }}
325383 needs :
326384 - setup
327385 - dev-build
386+ - generate-upgrade-job-matrices
328387 strategy :
388+ fail-fast : false
329389 matrix :
330390 consul-version : [ "1.14", "1.15"]
391+ test-cases : ${{ fromJSON(needs.generate-upgrade-job-matrices.outputs.upgrade-matrix) }}
331392 env :
332393 CONSUL_VERSION : ${{ matrix.consul-version }}
333394 steps :
@@ -351,33 +412,30 @@ jobs:
351412 run : chmod +x consul
352413 - name : Build consul:local image
353414 run : docker build -t ${{ env.CONSUL_LATEST_IMAGE_NAME }}:local -f ./build-support/docker/Consul-Dev.dockerfile .
354- - name : Upgrade Integration Tests
415+ - name : Configure GH workaround for ipv6 loopback
416+ if : ${{ !endsWith(github.repository, '-enterprise') }}
355417 run : |
356418 cat /etc/hosts && echo "-----------"
357419 sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6-localhost ip6-loopback/g' /etc/hosts
358420 cat /etc/hosts
421+ - name : Upgrade Integration Tests
422+ run : |
359423 mkdir -p "${{ env.TEST_RESULTS_DIR }}"
360424 cd ./test/integration/consul-container/test/upgrade
361425 docker run --rm ${{ env.CONSUL_LATEST_IMAGE_NAME }}:local consul version
362- # shellcheck disable=SC2046
363- PACKAGE_NAMES=$(go list -tags "${{ env.GOTAGS }}" ./...)
364- gotestsum \
365- --raw-command \
366- --format=short-verbose \
367- --debug \
368- --rerun-fails=3 \
369- --packages="${PACKAGE_NAMES}" \
370- -- \
371- go test \
372- -p=4 \
373- -tags "${{ env.GOTAGS }}" \
374- -timeout=30m \
375- -json \
376- ./... \
377- --target-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
378- --target-version local \
379- --latest-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
380- --latest-version "${{ env.CONSUL_VERSION }}"
426+ echo "Running $(sed 's,|, ,g' <<< "${{ matrix.test-cases }}" |wc -w) subtests"
427+ # shellcheck disable=SC2001
428+ sed 's,|,\n,g' <<< "${{ matrix.test-cases }}"
429+ go test \
430+ -p=4 \
431+ -tags "${{ env.GOTAGS }}" \
432+ -timeout=30m \
433+ -json ./... \
434+ -run "${{ matrix.test-cases }}" \
435+ --target-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
436+ --target-version local \
437+ --latest-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
438+ --latest-version "${{ env.CONSUL_VERSION }}"
381439 ls -lrt
382440 env :
383441 # this is needed because of incompatibility between RYUK container and circleci
@@ -394,12 +452,14 @@ jobs:
394452 test-integrations-success :
395453 needs :
396454 - setup
397- - generate-envoy-job-matrices
398455 - dev-build
399456 - nomad-integration-test
400457 - vault-integration-test
458+ - generate-envoy-job-matrices
401459 - envoy-integration-test
460+ - generate-compatibility-job-matrices
402461 - compatibility-integration-test
462+ - generate-upgrade-job-matrices
403463 - upgrade-integration-test
404464 runs-on : ${{ fromJSON(needs.setup.outputs.compute-small) }}
405465 if : |
0 commit comments