Increase splits for faster test results turnaround.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-10-02 11:21:32 +01:00 committed by Pedro Algarvio
parent 72976d6a0b
commit 18defa2f5d
3 changed files with 24 additions and 14 deletions

View file

@ -107,6 +107,7 @@ jobs:
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}
env:
SALT_TRANSPORT: ${{ matrix.transport }}
TEST_GROUP: ${{ matrix.test-group || 1 }}
steps:
- name: Checkout Source Code
@ -248,8 +249,8 @@ jobs:
run: |
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
--nox-session=${{ inputs.nox-session }} --rerun-failures -E SALT_TRANSPORT ${{ (inputs.skip-code-coverage && matrix.tests-chunk != 'unit') && '--skip-code-coverage' || '' }} \
${{ inputs.distro-slug }} ${{ matrix.tests-chunk }} -- --slow-tests --core-tests \
--test-group-count=${{ matrix.test-chunk-total || 1 }} --test-group=${{ matrix.test-chunk-no || 1 }}
-E TEST_GROUP ${{ inputs.distro-slug }} ${{ matrix.tests-chunk }} -- --slow-tests --core-tests \
--test-group-count=${{ matrix.test-group-count || 1 }} --test-group=${{ matrix.test-group || 1 }}
- name: Combine Coverage Reports
if: always() && inputs.skip-code-coverage == false && steps.spin-up-vm.outcome == 'success' && job.status != 'cancelled'
@ -266,7 +267,7 @@ jobs:
rm -rf artifacts/salt*
tree -a artifacts
if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then
mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }}.${{ matrix.test-chunk-no || '1' }}
mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }}.grp${{ matrix.test-group || '1' }}
fi
- name: Destroy VM
@ -311,7 +312,7 @@ jobs:
# always run even if the previous steps fails
if: always() && inputs.skip-junit-reports == false
with:
check_name: Test Results(${{ inputs.distro-slug }}, transport=${{ matrix.transport }}, tests-chunk=${{ matrix.tests-chunk }})
check_name: Test Results(${{ inputs.distro-slug }}, transport=${{ matrix.transport }}, tests-chunk=${{ matrix.tests-chunk }}, group=${{ matrix.test-group || '1' }})
report_paths: 'artifacts/xml-unittests-output/*.xml'
annotate_only: true

View file

@ -1065,6 +1065,8 @@ def _ci_test(session, transport, onedir=False):
"scenarios": ["tests/pytests/scenarios"],
}
test_group_number = os.environ.get("TEST_GROUP") or "1"
if not session.posargs:
chunk_cmd = []
junit_report_filename = "test-results"
@ -1081,20 +1083,20 @@ def _ci_test(session, transport, onedir=False):
for values in chunks.values():
for value in values:
chunk_cmd.append(f"--ignore={value}")
junit_report_filename = f"test-results-{chunk}"
runtests_log_filename = f"runtests-{chunk}"
junit_report_filename = f"test-results-{chunk}-grp{test_group_number}"
runtests_log_filename = f"runtests-{chunk}-grp{test_group_number}"
else:
chunk_cmd = chunks[chunk]
junit_report_filename = f"test-results-{chunk}"
runtests_log_filename = f"runtests-{chunk}"
junit_report_filename = f"test-results-{chunk}-grp{test_group_number}"
runtests_log_filename = f"runtests-{chunk}-grp{test_group_number}"
if session.posargs:
if session.posargs[0] == "--":
session.posargs.pop(0)
chunk_cmd.extend(session.posargs)
else:
chunk_cmd = [chunk] + session.posargs
junit_report_filename = "test-results"
runtests_log_filename = "runtests"
junit_report_filename = f"test-results-grp{test_group_number}"
runtests_log_filename = f"runtests-grp{test_group_number}"
rerun_failures = os.environ.get("RERUN_FAILURES", "0") == "1"
track_code_coverage = os.environ.get("SKIP_CODE_COVERAGE", "0") == "0"

View file

@ -619,6 +619,12 @@ def matrix(ctx: Context, distro_slug: str, full: bool = False):
Generate the test matrix.
"""
_matrix = []
_splits = {
"functional": 4,
"integration": 6,
"scenarios": 2,
"unit": 3,
}
for transport in ("zeromq", "tcp"):
if transport == "tcp":
if distro_slug not in (
@ -635,14 +641,15 @@ def matrix(ctx: Context, distro_slug: str, full: bool = False):
continue
if "macos" in distro_slug and chunk == "scenarios":
continue
if full and chunk == "integration":
for idx in range(1, 3):
splits = _splits.get(chunk) or 1
if full and splits > 1:
for split in range(1, splits + 1):
_matrix.append(
{
"transport": transport,
"tests-chunk": chunk,
"test-chunk-no": idx,
"test-chunk-total": 2,
"test-group": split,
"test-group-count": splits,
}
)
else: