Repository: yetus Updated Branches: refs/heads/master 3f250f01e -> 4315582d4
YETUS-543 Add shaded client related ITs to Hadoop exemplar personality Signed-off-by: Andrew Wang <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/4315582d Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/4315582d Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/4315582d Branch: refs/heads/master Commit: 4315582d495c8b7cc9de4c10b5649863b89e4149 Parents: 3f250f0 Author: Sean Busbey <[email protected]> Authored: Sat Sep 9 01:59:46 2017 -0500 Committer: Sean Busbey <[email protected]> Committed: Wed Sep 13 14:12:26 2017 -0500 ---------------------------------------------------------------------- precommit/personality/hadoop.sh | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/4315582d/precommit/personality/hadoop.sh ---------------------------------------------------------------------- diff --git a/precommit/personality/hadoop.sh b/precommit/personality/hadoop.sh index 1d7d696..ea52e40 100755 --- a/precommit/personality/hadoop.sh +++ b/precommit/personality/hadoop.sh @@ -38,6 +38,7 @@ function personality_globals GITHUB_REPO="apache/hadoop" #shellcheck disable=SC2034 PYLINT_OPTIONS="--indent-string=' '" + CLIENT_TESTS=() HADOOP_HOMEBREW_DIR=${HADOOP_HOMEBREW_DIR:-$(brew --prefix 2>/dev/null)} if [[ -z "${HADOOP_HOMEBREW_DIR}" ]]; then @@ -458,3 +459,74 @@ function hadoop_console_success printf "ICAgICAgIHwgICBvICAgfCAgCiAgICAgICAgfCB8ICAgfCB8ICAKICAgICAg"; printf "ICB8bXwgICB8bXwgIAo" } + +################################################### +# Hadoop project specific check of IT for shaded artifacts + +add_test_type shadedclient + +## @description check for test modules and add test/plugins as needed +## @audience private +## @stability evolving +function shadedclient_initialize +{ + declare -a modules=() + declare module + + yetus_debug "hadoop personality: initializing client artifacts checks." + for module in hadoop-client-modules/hadoop-client-check-invariants \ + hadoop-client-modules/hadoop-client-check-test-invariants \ + hadoop-client-modules/hadoop-client-integration-tests; do + if [ -d "${module}" ]; then + yetus_debug "hadoop personality: test module '${module}' is present." + modules=( ${modules[@]} -pl ${module} ) + fi + done + if [ ${#modules[@]} -gt 0 ]; then + CLIENT_TESTS=( "${modules[@]}" ) + maven_add_install shadedclient + add_test shadedclient + fi +} + +## @description remove files created by the rebuild function +## @audience private +## @stability evolving +function shadedclient_clean +{ + if [ ${#CLIENT_TESTS[@]} -gt 0 ]; then + yetus_debug "hadoop personality: cleaning up test modules." + "${MAVEN}" "${MAVEN_ARGS[@]}" clean -fae -am "${CLIENT_TESTS[@]}" + fi +} + +## @description build client facing shaded artifacts and test them +## @audience private +## @stability evolving +## @param repostatus +function shadedclient_rebuild +{ + local repostatus=$1 + local logfile="${PATCH_DIR}/${repostatus}-shadedclient.txt" + + if [ ${#CLIENT_TESTS[@]} -eq 0 ]; then + yetus_debug "hadoop personality: no test modules present, skipping." + return 0 + fi + + big_console_header "Checking client artifacts on ${repostatus}" + + echo_and_redirect "${logfile}" \ + "${MAVEN}" "${MAVEN_ARGS[@]}" clean verify -fae --batch-mode -am \ + "${CLIENT_TESTS[@]}" \ + -Dtest=NoUnitTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dfindbugs.skip=true + + count=$(${GREP} -c '\[ERROR\]' "${logfile}") + if [[ ${count} -gt 0 ]]; then + add_vote_table -1 shadedclient "${repostatus} has errors when building and testing our client artifacts." + return 1 + fi + + add_vote_table +1 shadedclient "${repostatus} has no errors when building and testing our client artifacts." + return 0 +}
