Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions .github/scripts/generate_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,49 @@
import glob
import json

SUITES_PATH = "dirsrvtests/tests/suites"


def is_valid_suite_dir(suite):
test_path = os.path.join(SUITES_PATH, suite)
return (
os.path.isdir(test_path)
and not os.path.islink(test_path)
and not suite.startswith(".")
and suite != "__pycache__"
Comment thread
droideck marked this conversation as resolved.
)


def is_valid_suite_file(suite):
test_path = os.path.join(SUITES_PATH, suite)
return (
os.path.isfile(test_path)
and not os.path.islink(test_path)
and suite.endswith(".py")
)


# If we have arguments passed to the script, use them as the test names to run
if len(sys.argv) > 1:
suites = sys.argv[1:]
valid_suites = []
# Validate if the path is a valid file or directory with files
for suite in suites:
test_path = os.path.join("dirsrvtests/tests/suites/", suite)
if os.path.exists(test_path) and not os.path.islink(test_path):
if os.path.isfile(test_path) and test_path.endswith(".py"):
valid_suites.append(suite)
elif os.path.isdir(test_path):
valid_suites.append(suite)
if is_valid_suite_file(suite) or is_valid_suite_dir(suite):
valid_suites.append(suite)
suites = valid_suites

else:
# Use tests from the source
suites = next(os.walk('dirsrvtests/tests/suites/'))[1]
suites = [suite for suite in next(os.walk(SUITES_PATH))[1] if is_valid_suite_dir(suite)]

# Run each replication test module separately to speed things up
suites.remove('replication')
repl_tests = glob.glob('dirsrvtests/tests/suites/replication/*_test.py')
suites += [repl_test.replace('dirsrvtests/tests/suites/', '') for repl_test in repl_tests]
repl_tests = glob.glob(os.path.join(SUITES_PATH, 'replication/*_test.py'))
suites += [repl_test.replace(f'{SUITES_PATH}/', '') for repl_test in repl_tests]
suites.sort()

suites_list = [{ "suite": suite} for suite in suites]
matrix = {"include": suites_list}

print(json.dumps(matrix))

2 changes: 1 addition & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
cpp-compiler: g++
cflags: "-O2 -g"

- name: GCC strict
- name: GCC Strict
image: quay.io/389ds/ci-images:fedora
compiler: gcc
cpp-compiler: g++
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lmdbpytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
needs: build
strategy:
fail-fast: false
max-parallel: 6
matrix: ${{ fromJson(needs.build.outputs.matrix) }}

steps:
Expand Down Expand Up @@ -149,4 +150,3 @@ jobs:
pytest.html
assets
.playwright-screenshots

2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
needs: build
strategy:
fail-fast: false
max-parallel: 6
matrix: ${{ fromJson(needs.build.outputs.matrix) }}

steps:
Expand Down Expand Up @@ -155,4 +156,3 @@ jobs:
pytest.html
assets
.playwright-screenshots

Loading