Skip to content

Commit

Permalink
Merge pull request #1 from vpodorozh/integration-tests-workflow-impro…
Browse files Browse the repository at this point in the history
…vement

WIP: Update full-integration-tests.yaml
  • Loading branch information
vpodorozh authored Jan 16, 2024
2 parents be07609 + 7b222e2 commit 91cef53
Showing 1 changed file with 54 additions and 14 deletions.
68 changes: 54 additions & 14 deletions .github/workflows/full-integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
type: string
description: "head SHA"
required: true
test_directory:
type: string
description: "Test directory to run integration tests"
required: false

permissions:
contents: write
Expand Down Expand Up @@ -49,10 +53,24 @@ jobs:
name: Calculate Matrix for testsuite
working-directory: dev/tests/integration
run: |
### TODO: rebuild all that hell to node-js
if [ -n "${{ github.event.inputs.test_directory }}" ]; then
echo "testsuite_dirs=['${{ github.event.inputs.test_directory }}']" >> "$GITHUB_OUTPUT"
exit 0
fi
OUTPUT_FILE="integration-testsuites.json"
TESTSUITE_DIR="./testsuite/Magento"
CODE_DIR="../../../app/code"
MAX_DIRS_PER_LINE=15
MAX_DIRS_PER_LINE=1
## variable with array of exclusion list of directories - they will be handled separately and splitted on more batches
EXCLUSION_LIST=("./testsuite/Magento/Catalog" "./testsuite/Magento/Bundle" "./testsuite/Magento/AsynchronousOperations" "./testsuite/Magento/Sales")
## variable with array of exclusion list of files - separate run will be executed for each file (separate place in tests matrix)
STANDALONE_TESTS=("./testsuite/Magento/AsynchronousOperations/Model/MassScheduleTest.php" "./testsuite/Magento/Catalog/Observer/SwitchPriceAttributeScopeOnConfigChangeTest.php")
# Initialize variables
dir_count=0
Expand Down Expand Up @@ -80,15 +98,48 @@ jobs:
# Iterate over the directories and populate the JSON content
while IFS= read -r -d '' dir; do
add_dir_to_line "${dir}"
# if dir is in EXCLUSION_LIST then skip it
if [[ " ${EXCLUSION_LIST[@]} " =~ " ${dir} " ]]; then
continue
fi
add_dir_to_line "${dir}"
done < <(find "$TESTSUITE_DIR" -mindepth 1 -maxdepth 1 -type d -print0)
# Add app/code integration test directories
while IFS= read -r -d '' dir; do
relative_dir="${dir}" # Convert absolute path to relative
add_dir_to_line "$relative_dir"
done < <(find "$CODE_DIR" -mindepth 4 -maxdepth 4 -type d -name 'Integration' -print0)
# Handle exclusion list
# run over EXCLUSION_LIST, find all "*Test.php" files, and put them in array. Exclude directories.
EXCLUSION_LIST_FILES=()
for dir in "${EXCLUSION_LIST[@]}"; do
while IFS= read -r -d '' file; do
# check if file is in STANDALONE_TESTS
if [[ " ${STANDALONE_TESTS[@]} " =~ " ${file} " ]]; then
continue
fi
EXCLUSION_LIST_FILES+=("$file")
done < <(find "$dir" -mindepth 1 -type f -name '*Test.php' -print0)
done
## run over EXCLUSION_LIST_FILES and call add_dir_to_line for each file
MAX_DIRS_PER_LINE=10
dir_count=MAX_DIRS_PER_LINE-1
add_dir_to_line ""
for file in "${EXCLUSION_LIST_FILES[@]}"; do
add_dir_to_line "$file"
done
## run over STANDALONE_TESTS and call add_dir_to_line for each file
MAX_DIRS_PER_LINE=1
dir_count=MAX_DIRS_PER_LINE-1
add_dir_to_line ""
for file in "${STANDALONE_TESTS[@]}"; do
add_dir_to_line "$file"
done
# Handle the last line if it's not empty
if [ -n "$current_line" ]; then
json_content="$json_content$current_line"
Expand Down Expand Up @@ -158,17 +209,6 @@ jobs:
run_magento_integration_tests_real_suite: 0
base_directory: "./main"

# TODO: this have to be removed after we analyse and fix all tests
# added now because it kills too many tests that are going to be running
- name: Skip invalid tests
working-directory: ./main
run: |
echo "Patch file dev/tests/integration/testsuite/Magento/Downloadable/Block/Sales/Order/Email/Items/Order/DownloadableTest.php"
echo "Add new line after line 47"
sed -i '47 a $this->markTestSkipped('"'"'TODO: skipped temporary due to execution errors'"'"');' dev/tests/integration/testsuite/Magento/Downloadable/Block/Sales/Order/Email/Items/Order/DownloadableTest.php
echo "Patch complete"
# here bash code that perform the patch ends
- name: Create Mage-OS testsuite
working-directory: ./main/dev/tests/integration
run: |
Expand Down

0 comments on commit 91cef53

Please sign in to comment.