Skip to content

Update PR tests to complete all tests before returning results. #1065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2018
Merged
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
20 changes: 15 additions & 5 deletions .kokoro/tests/diff_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,47 @@ gcloud auth activate-service-account\
--project=$GOOGLE_CLOUD_PROJECT

echo -e "\n******************** TESTING AFFECTED PROJECTS ********************"
set +e
# Diff to find out what has changed from master
RESULT=0
cd github/java-docs-samples
find * -name pom.xml -print0 | sort -z | while read -d $'\0' file
do
# For every pom.xml (may break on whitespace)
for file in **/pom.xml; do
# Navigate to project
file=$(dirname "$file")
pushd "$file" > /dev/null

set +e
# Only tests changed projects
git diff --quiet master.. .
CHANGED=$?
# Only test leafs to prevent testing twice
PARENT=$(grep "<modules>" pom.xml -c)
set -e

# Check for changes to the current folder
if [ "$CHANGED" -eq 1 ] && [ "$PARENT" -eq 0 ]; then
echo "------------------------------------------------------------"
echo "- testing $file"
echo "------------------------------------------------------------"

# Run tests and update RESULT if failed
mvn -q --batch-mode --fail-at-end clean verify \
-Dfile.encoding="UTF-8" \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dmaven.test.redirectTestOutputToFile=true \
-Dbigtable.projectID="${GOOGLE_CLOUD_PROJECT}" \
-Dbigtable.instanceID=instance
echo -e "\n Tests complete. \n"
EXIT=$?

if [ $EXIT -ne 0 ]; then
echo -e "\n Tests failed. \n"
RESULT=1
else
echo -e "\n Tests complete. \n"
fi
fi

popd > /dev/null

done

exit $RESULT