Skip to content

Commit de7f27f

Browse files
magyari-adamadamsaghy
authored andcommitted
FINERACT-2181: Fix github actions not failing test runs on failed tests
- added validation for cumulative multidisburse loan applications for interest method - test fixes
1 parent 84f7c92 commit de7f27f

32 files changed

Lines changed: 998 additions & 869 deletions

.github/workflows/build-cucumber.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
- name: Run Gradle Task
5454
if: matrix.job_type == 'main'
5555
run: |
56+
set -e # Fail the script if any command fails
57+
5658
case "${{ matrix.task }}" in
5759
build-core)
5860
./gradlew --no-daemon build -x test -x cucumber -x doc

.github/workflows/build-docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
build:
1010
runs-on: ubuntu-24.04
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
db_type: [mariadb, postgresql]
1415
include:

.github/workflows/build-e2e-tests.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,21 @@ jobs:
8585
https://localhost:8443/fineract-provider/actuator/health
8686
8787
- name: Execute tests for shard ${{ matrix.shard_index }}
88+
id: tests
8889
run: |
89-
# Read feature files from the shard file
90-
FEATURES=$(tr '\n' ',' < "feature_shard_${{ matrix.shard_index }}.txt" | sed 's/,$//')
90+
# Initialize failure flag
91+
FAILED=0
92+
93+
# Create necessary directories
94+
mkdir -p "allure-results-shard-${{ matrix.shard_index }}"
95+
mkdir -p "allure-results-merged"
9196
92-
if [ -z "$FEATURES" ]; then
97+
# Read feature files from the shard file
98+
if [ ! -s "feature_shard_${{ matrix.shard_index }}.txt" ]; then
9399
echo "No features to test in this shard. Skipping..."
94100
exit 0
95101
fi
96102
97-
# Create a directory for individual allure results
98-
mkdir -p "allure-results-shard-${{ matrix.shard_index }}"
99-
100103
# Read each feature file path and run tests one by one
101104
while IFS= read -r feature_file || [ -n "$feature_file" ]; do
102105
# Skip empty lines
@@ -105,14 +108,20 @@ jobs:
105108
# Create a safe filename for the results
106109
safe_name=$(echo "$feature_file" | tr '/' '-' | tr ' ' '_')
107110
108-
echo "Testing feature: $feature_file"
111+
echo "::group::Testing feature: $feature_file"
109112
110113
# Run tests with individual allure results directory
111-
./gradlew --no-daemon --console=plain \
114+
if ! ./gradlew --no-daemon --console=plain \
112115
:fineract-e2e-tests-runner:cucumber \
113116
-Pcucumber.features="$feature_file" \
114117
-Dallure.results.directory="allure-results-shard-${{ matrix.shard_index }}/$safe_name" \
115-
allureReport || echo "Test failed for $feature_file, continuing with next feature..."
118+
allureReport; then
119+
120+
echo "::error::Test failed for $feature_file"
121+
FAILED=1
122+
fi
123+
124+
echo "::endgroup::"
116125
117126
# Copy the results to a merged directory
118127
if [ -d "allure-results-shard-${{ matrix.shard_index }}/$safe_name" ]; then
@@ -121,9 +130,17 @@ jobs:
121130
done < "feature_shard_${{ matrix.shard_index }}.txt"
122131
123132
# Generate individual report for this shard
124-
if [ -d "allure-results-merged" ]; then
133+
if [ -d "allure-results-merged" ] && [ "$(ls -A allure-results-merged)" ]; then
134+
echo "Generating Allure report..."
125135
mkdir -p "allure-report-shard-${{ matrix.shard_index }}"
126-
allure generate "allure-results-merged" --clean -o "allure-report-shard-${{ matrix.shard_index }}" || echo "Failed to generate Allure report for shard ${{ matrix.shard_index }}"
136+
./fineract-e2e-tests-runner/build/allure/commandline/bin/allure generate "allure-results-merged" --clean -o "allure-report-shard-${{ matrix.shard_index }}" || \
137+
echo "::warning::Failed to generate Allure report for shard ${{ matrix.shard_index }}"
138+
fi
139+
140+
# Exit with failure status if any test failed
141+
if [ "$FAILED" -eq 1 ]; then
142+
echo "::error::Some tests failed in this shard"
143+
exit 1
127144
fi
128145
129146
- name: Upload test results

.github/workflows/build-mariadb.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,22 @@ jobs:
9494
9595
- name: Run Gradle Task
9696
run: |
97+
set -e # Fail the script if any command fails
9798
SHARD_INDEX=$(echo "${{ matrix.task }}" | awk -F'-' '{print $3}')
99+
FAILED=0
100+
98101
case "${{ matrix.task }}" in
99102
test-twofactor)
100-
./gradlew --no-daemon :twofactor-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
103+
if ! ./gradlew --no-daemon :twofactor-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
104+
echo "::error::Two-factor tests failed"
105+
FAILED=1
106+
fi
101107
;;
102108
test-oauth2)
103-
./gradlew --no-daemon :oauth2-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
109+
if ! ./gradlew --no-daemon :oauth2-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
110+
echo "::error::OAuth2 tests failed"
111+
FAILED=1
112+
fi
104113
;;
105114
test-core-*)
106115
echo "Grouping test classes by module..."
@@ -111,7 +120,7 @@ jobs:
111120
done < "shard-tests_${SHARD_INDEX}.txt"
112121
113122
for module in "${!module_tests[@]}"; do
114-
echo "Running tests in $module:"
123+
echo "::group::Running tests in $module"
115124
for class in ${module_tests[$module]}; do
116125
echo " - $class"
117126
done
@@ -120,11 +129,21 @@ jobs:
120129
test_args=$(for class in ${module_tests[$module]}; do echo --tests "$class"; done | xargs)
121130
122131
# Run test task for this module
123-
./gradlew "$module:test" $test_args -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
132+
if ! ./gradlew "$module:test" $test_args -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
133+
echo "::error::Tests failed in module $module"
134+
FAILED=1
135+
fi
136+
echo "::endgroup::"
124137
done
125138
;;
126139
esac
127140
141+
# Exit with failure status if any test failed
142+
if [ "$FAILED" -eq 1 ]; then
143+
echo "::error::Some tests failed in this job"
144+
exit 1
145+
fi
146+
128147
- name: Archive test results
129148
if: always()
130149
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4

.github/workflows/build-mysql.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,22 @@ jobs:
9494
9595
- name: Run Gradle Task
9696
run: |
97+
set -e # Fail the script if any command fails
9798
SHARD_INDEX=$(echo "${{ matrix.task }}" | awk -F'-' '{print $3}')
99+
FAILED=0
100+
98101
case "${{ matrix.task }}" in
99102
test-twofactor)
100-
./gradlew --no-daemon :twofactor-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
103+
if ! ./gradlew --no-daemon :twofactor-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
104+
echo "::error::Two-factor tests failed"
105+
FAILED=1
106+
fi
101107
;;
102108
test-oauth2)
103-
./gradlew --no-daemon :oauth2-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
109+
if ! ./gradlew --no-daemon :oauth2-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
110+
echo "::error::OAuth2 tests failed"
111+
FAILED=1
112+
fi
104113
;;
105114
test-core-*)
106115
echo "Grouping test classes by module..."
@@ -111,7 +120,7 @@ jobs:
111120
done < "shard-tests_${SHARD_INDEX}.txt"
112121
113122
for module in "${!module_tests[@]}"; do
114-
echo "Running tests in $module:"
123+
echo "::group::Running tests in $module"
115124
for class in ${module_tests[$module]}; do
116125
echo " - $class"
117126
done
@@ -120,11 +129,21 @@ jobs:
120129
test_args=$(for class in ${module_tests[$module]}; do echo --tests "$class"; done | xargs)
121130
122131
# Run test task for this module
123-
./gradlew "$module:test" $test_args -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
132+
if ! ./gradlew "$module:test" $test_args -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
133+
echo "::error::Tests failed in module $module"
134+
FAILED=1
135+
fi
136+
echo "::endgroup::"
124137
done
125138
;;
126139
esac
127140
141+
# Exit with failure status if any test failed
142+
if [ "$FAILED" -eq 1 ]; then
143+
echo "::error::Some tests failed in this job"
144+
exit 1
145+
fi
146+
128147
- name: Archive test results
129148
if: always()
130149
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4

.github/workflows/build-postgresql.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,22 @@ jobs:
9595
9696
- name: Run Gradle Task
9797
run: |
98+
set -e # Fail the script if any command fails
9899
SHARD_INDEX=$(echo "${{ matrix.task }}" | awk -F'-' '{print $3}')
100+
FAILED=0
101+
99102
case "${{ matrix.task }}" in
100103
test-twofactor)
101-
./gradlew --no-daemon :twofactor-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
104+
if ! ./gradlew --no-daemon :twofactor-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
105+
echo "::error::Two-factor tests failed"
106+
FAILED=1
107+
fi
102108
;;
103109
test-oauth2)
104-
./gradlew --no-daemon :oauth2-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
110+
if ! ./gradlew --no-daemon :oauth2-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
111+
echo "::error::OAuth2 tests failed"
112+
FAILED=1
113+
fi
105114
;;
106115
test-core-*)
107116
echo "Grouping test classes by module..."
@@ -112,7 +121,7 @@ jobs:
112121
done < "shard-tests_${SHARD_INDEX}.txt"
113122
114123
for module in "${!module_tests[@]}"; do
115-
echo "Running tests in $module:"
124+
echo "::group::Running tests in $module"
116125
for class in ${module_tests[$module]}; do
117126
echo " - $class"
118127
done
@@ -121,11 +130,21 @@ jobs:
121130
test_args=$(for class in ${module_tests[$module]}; do echo --tests "$class"; done | xargs)
122131
123132
# Run test task for this module
124-
./gradlew "$module:test" $test_args -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
133+
if ! ./gradlew "$module:test" $test_args -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
134+
echo "::error::Tests failed in module $module"
135+
FAILED=1
136+
fi
137+
echo "::endgroup::"
125138
done
126139
;;
127140
esac
128141
142+
# Exit with failure status if any test failed
143+
if [ "$FAILED" -eq 1 ]; then
144+
echo "::error::Some tests failed in this job"
145+
exit 1
146+
fi
147+
129148
- name: Archive test results
130149
if: always()
131150
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class LoanRequestFactory {
7979
public static final Integer DEFAULT_REAGING_FREQUENCY_NUMBER = 1;
8080
public static final String DEFAULT_REAGING_FREQUENCY_TYPE = "MONTHS";
8181
public static final BigDecimal DEFAULT_INTEREST_RATE_PER_PERIOD = new BigDecimal(0);
82-
public static final Integer DEFAULT_INTEREST_TYPE = InterestType.FLAT.value;
82+
public static final Integer DEFAULT_INTEREST_TYPE = InterestType.DECLINING_BALANCE.value;
8383
public static final Integer DEFAULT_PROGRESSIVE_INTEREST_TYPE = InterestType.DECLINING_BALANCE.value;
8484
public static final Integer DEFAULT_INTEREST_CALCULATION_PERIOD_TYPE_SAME_AS_REPAYMENT_PERIOD = InterestCalculationPeriodTime.SAME_AS_REPAYMENT_PERIOD.value;
8585
public static final Integer DEFAULT_PROGRESSIVE_INTEREST_CALCULATION_PERIOD_TYPE_SAME_AS_REPAYMENT_PERIOD = InterestCalculationPeriodTime.DAILY.value;

0 commit comments

Comments
 (0)