Skip to content
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

Testing Diff Tests #1029

Closed
wants to merge 6 commits into from
Closed
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
31 changes: 16 additions & 15 deletions .kokoro/tests/diff_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ shopt -s globstar
trap '' HUP

# Update gcloud and check version
gcloud components update --quiet
gcloud components update --quiet 1> /dev/null
echo -e "\n ********** GCLOUD INFO *********** \n"
gcloud -v
echo -e "\n ********** MAVEN INFO *********** \n"
mvn -v
echo -e "\n ********** GRADLE INFO *********** "
gradle -v

# Setup required enviormental variables
# Setup required environmental variables
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-acct.json
export GOOGLE_CLOUD_PROJECT=java-docs-samples-testing
source ${KOKORO_GFILE_DIR}/aws-secrets.sh
Expand All @@ -37,35 +37,36 @@ gcloud auth activate-service-account\
--key-file=$GOOGLE_APPLICATION_CREDENTIALS \
--project=$GOOGLE_CLOUD_PROJECT

echo -e "\n******************** CHECKING FOR AFFECTED FOLDERS ********************"
echo -e "\n******************** TESTING AFFECTED PROJECTS ********************"
# Diff to find out what has changed from master
cd github/java-docs-samples
find ./*/ -name pom.xml -print0 | sort -z | while read -d $'\0' file
find * -name pom.xml -print0 | sort -z | while read -d $'\0' file
do
# Navigate to project
file=$(dirname "$file")
echo "------------------------------------------------------------"
echo "- checking $file"
echo "------------------------------------------------------------"


pushd "$file" > /dev/null

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

# Check for changes to the current folder
if [ "$RTN" -eq 1 ]; then
echo -e "\n Change detected. Running tests. \n "
if [ "$CHANGED" -eq 1 ] && [ "$PARENT" -eq 0 ]; then
echo "------------------------------------------------------------"
echo "- testing $file"
echo "------------------------------------------------------------"

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 " Tests complete. \n"
else
echo -e "\n NO change found. \n"
echo -e "\n Tests complete. \n"
fi

popd > /dev/null
Expand Down
2 changes: 1 addition & 1 deletion appengine-java8/bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ limitations under the License.
<dependency>
<groupId>com.google.cloud.bigtable</groupId>
<artifactId>bigtable-hbase-1.x</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
</dependency>

<!-- Compile/runtime dependencies -->
Expand Down