Commit 86fb9da4 by Sarath Subramanian

ATLAS-2059: Update test-patch.sh script for PreCommit-ATLAS-Build jenkins job

parent a7e2f50b
No related merge requests found
...@@ -123,6 +123,21 @@ parseArgs() { ...@@ -123,6 +123,21 @@ parseArgs() {
--run-tests) --run-tests)
RUN_TESTS=true RUN_TESTS=true
;; ;;
--review-id=*)
REVIEW_ID=${i#*=}
;;
--local-patch=*)
LOCAL_PATCH=${i#*=}
;;
--branch=*)
BRANCH=${i#*=}
;;
--skip-ut=*)
SKIP_UT=${i#*=}
;;
--skip-it=*)
SKIP_IT=${i#*=}
;;
*) *)
PATCH_OR_DEFECT=$i PATCH_OR_DEFECT=$i
;; ;;
...@@ -184,7 +199,7 @@ checkout () { ...@@ -184,7 +199,7 @@ checkout () {
cd $BASEDIR cd $BASEDIR
$GIT reset --hard $GIT reset --hard
$GIT clean -xdf $GIT clean -xdf
$GIT checkout master $GIT checkout $BRANCH
$GIT pull --rebase $GIT pull --rebase
fi fi
GIT_REVISION=`git rev-parse --verify --short HEAD` GIT_REVISION=`git rev-parse --verify --short HEAD`
...@@ -195,24 +210,29 @@ checkout () { ...@@ -195,24 +210,29 @@ checkout () {
downloadPatch () { downloadPatch () {
### Download latest patch file (ignoring .htm and .html) when run from patch process ### Download latest patch file (ignoring .htm and .html) when run from patch process
if [[ $JENKINS == "true" ]] ; then if [[ $JENKINS == "true" ]] ; then
$WGET -q -O $PATCH_DIR/jira http://issues.apache.org/jira/browse/$defect if [[ -n $REVIEW_ID ]]; then
if [[ `$GREP -c 'Patch Available' $PATCH_DIR/jira` == 0 ]] ; then echo "Download Patch from Review Board: https://reviews.apache.org/r/$REVIEW_ID/diff/raw at `date`"
echo "$defect is not \"Patch Available\". Exiting." $WGET -q -O $PATCH_DIR/patch https://reviews.apache.org/r/$REVIEW_ID/diff/raw
cleanupAndExit 0 elif [[ -n $LOCAL_PATCH ]]; then
echo "Using Local Patch in $LOCAL_PATCH at `date`"
else
echo "Download Patch from JIRA: http://issues.apache.org/jira/browse/$defect at `date`"
$WGET -q -O $PATCH_DIR/jira http://issues.apache.org/jira/browse/$defect
if [[ `$GREP -c 'Patch Available' $PATCH_DIR/jira` == 0 ]] ; then
echo "$defect is not \"Patch Available\". Exiting."
cleanupAndExit 0
fi
relativePatchURL=`$GREP -o '"/jira/secure/attachment/[0-9]*/[^"]*' $PATCH_DIR/jira | $GREP -v -e 'htm[l]*$' | sort | tail -1 | $GREP -o '/jira/secure/attachment/[0-9]*/[^"]*'`
patchURL="http://issues.apache.org${relativePatchURL}"
patchNum=`echo $patchURL | $GREP -o '[0-9]*/' | $GREP -o '[0-9]*'`
echo "$defect patch is being downloaded at `date` from"
echo "$patchURL"
$WGET -q -O $PATCH_DIR/patch $patchURL
VERSION=${GIT_REVISION}_${defect}_PATCH-${patchNum}
JIRA_COMMENT="Here are the results of testing the latest attachment $patchURL against master revision ${GIT_REVISION}."
fi fi
relativePatchURL=`$GREP -o '"/jira/secure/attachment/[0-9]*/[^"]*' $PATCH_DIR/jira | $GREP -v -e 'htm[l]*$' | sort | tail -1 | $GREP -o '/jira/secure/attachment/[0-9]*/[^"]*'`
patchURL="http://issues.apache.org${relativePatchURL}"
patchNum=`echo $patchURL | $GREP -o '[0-9]*/' | $GREP -o '[0-9]*'`
echo "$defect patch is being downloaded at `date` from"
echo "$patchURL"
$WGET -q -O $PATCH_DIR/patch $patchURL
VERSION=${GIT_REVISION}_${defect}_PATCH-${patchNum}
JIRA_COMMENT="Here are the results of testing the latest attachment
$patchURL
against master revision ${GIT_REVISION}."
### Copy the patch file to $PATCH_DIR
else else
### Copy the patch file to $PATCH_DIR
VERSION=PATCH-${defect} VERSION=PATCH-${defect}
cp $PATCH_FILE $PATCH_DIR/patch cp $PATCH_FILE $PATCH_DIR/patch
if [[ $? == 0 ]] ; then if [[ $? == 0 ]] ; then
...@@ -557,13 +577,29 @@ buildAndInstall () { ...@@ -557,13 +577,29 @@ buildAndInstall () {
echo "" echo ""
echo "======================================================================" echo "======================================================================"
echo "======================================================================" echo "======================================================================"
echo " Installing all of the jars" echo " Build, Install And Run Tests"
echo "======================================================================" echo "======================================================================"
echo "======================================================================" echo "======================================================================"
echo "" echo ""
echo "" echo ""
echo "$MVN install -Dmaven.javadoc.skip=true -DskipTests -D${PROJECT_NAME}PatchProcess" #echo "$MVN clean install -DskipITs -D${PROJECT_NAME}PatchProcess"
$MVN install -Dmaven.javadoc.skip=true -DskipTests #$MVN clean install -DskipITs
MVN_GOALS="clean install -DskipCheck"
if [[ $SKIP_UT == "true" ]]; then
echo "Unit Tests flag set to true."
MVN_GOALS+=" -DskipUTs"
fi
if [[ $SKIP_IT == "true" ]]; then
echo "Integration Tests flag set to true."
MVN_GOALS+=" -DskipITs"
fi
echo "$MVN $MVN_GOALS"
$MVN $MVN_GOALS
return $? return $?
} }
...@@ -651,8 +687,8 @@ runTests () { ...@@ -651,8 +687,8 @@ runTests () {
test_timeouts="" test_timeouts=""
test_logfile=$PATCH_DIR/testrun.txt test_logfile=$PATCH_DIR/testrun.txt
echo " Running tests " echo " Running tests "
echo " $MVN clean install -fn -D${PROJECT_NAME}PatchProcess" echo " $MVN clean install -DskipITs -fn -D${PROJECT_NAME}PatchProcess"
$MVN clean install -fae > $test_logfile 2>&1 $MVN clean install -DskipITs -fae > $test_logfile 2>&1
test_build_result=$? test_build_result=$?
cat $test_logfile cat $test_logfile
module_test_timeouts=`$AWK '/^Running / { if (last) { print last } last=$2 } /^Tests run: / { last="" }' $test_logfile` module_test_timeouts=`$AWK '/^Running / { if (last) { print last } last=$2 } /^Tests run: / { last="" }' $test_logfile`
...@@ -750,8 +786,8 @@ $comment" ...@@ -750,8 +786,8 @@ $comment"
echo "" echo ""
### Update Jira with a comment ### Update Jira with a comment
export USER=hudson export USER=hudson
$JIRACLI -s https://issues.apache.org/jira -a addcomment -u atlasqa -p $JIRA_PASSWD --comment "$comment" --issue $defect #$JIRACLI -s https://issues.apache.org/jira -a addcomment -u atlasqa -p $JIRA_PASSWD --comment "$comment" --issue $defect
$JIRACLI -s https://issues.apache.org/jira -a logout -u atlasqa -p $JIRA_PASSWD #$JIRACLI -s https://issues.apache.org/jira -a logout -u atlasqa -p $JIRA_PASSWD
fi fi
} }
...@@ -803,7 +839,7 @@ if [[ $RESULT != 0 ]] ; then ...@@ -803,7 +839,7 @@ if [[ $RESULT != 0 ]] ; then
submitJiraComment 1 submitJiraComment 1
cleanupAndExit 1 cleanupAndExit 1
fi fi
prebuildWithoutPatch #prebuildWithoutPatch
(( RESULT = RESULT + $? )) (( RESULT = RESULT + $? ))
if [[ $RESULT != 0 ]] ; then if [[ $RESULT != 0 ]] ; then
submitJiraComment 1 submitJiraComment 1
...@@ -815,7 +851,7 @@ checkAuthor ...@@ -815,7 +851,7 @@ checkAuthor
if [[ $JENKINS == "true" ]] ; then if [[ $JENKINS == "true" ]] ; then
cleanUpXml cleanUpXml
fi fi
checkTests #checkTests
(( RESULT = RESULT + $? )) (( RESULT = RESULT + $? ))
applyPatch applyPatch
APPLY_PATCH_RET=$? APPLY_PATCH_RET=$?
...@@ -824,7 +860,7 @@ if [[ $APPLY_PATCH_RET != 0 ]] ; then ...@@ -824,7 +860,7 @@ if [[ $APPLY_PATCH_RET != 0 ]] ; then
submitJiraComment 1 submitJiraComment 1
cleanupAndExit 1 cleanupAndExit 1
fi fi
checkJavacWarnings #checkJavacWarnings
JAVAC_RET=$? JAVAC_RET=$?
#2 is returned if the code could not compile #2 is returned if the code could not compile
if [[ $JAVAC_RET == 2 ]] ; then if [[ $JAVAC_RET == 2 ]] ; then
...@@ -832,18 +868,18 @@ if [[ $JAVAC_RET == 2 ]] ; then ...@@ -832,18 +868,18 @@ if [[ $JAVAC_RET == 2 ]] ; then
cleanupAndExit 1 cleanupAndExit 1
fi fi
(( RESULT = RESULT + $JAVAC_RET )) (( RESULT = RESULT + $JAVAC_RET ))
checkJavadocWarnings #checkJavadocWarnings
(( RESULT = RESULT + $? )) (( RESULT = RESULT + $? ))
checkStyle #checkStyle
(( RESULT = RESULT + $? )) (( RESULT = RESULT + $? ))
checkFindbugsWarnings #checkFindbugsWarnings
(( RESULT = RESULT + $? )) (( RESULT = RESULT + $? ))
checkReleaseAuditWarnings #checkReleaseAuditWarnings
(( RESULT = RESULT + $? )) (( RESULT = RESULT + $? ))
buildAndInstall buildAndInstall
### Run tests for Jenkins or if explictly asked for by a developer ### Run tests for Jenkins or if explictly asked for by a developer
if [[ $JENKINS == "true" || $RUN_TESTS == "true" ]] ; then if [[ $JENKINS == "true" || $RUN_TESTS == "true" ]] ; then
runTests #runTests
(( RESULT = RESULT + $? )) (( RESULT = RESULT + $? ))
fi fi
JIRA_COMMENT_FOOTER="Test results: $BUILD_URL/testReport/ JIRA_COMMENT_FOOTER="Test results: $BUILD_URL/testReport/
......
...@@ -89,7 +89,7 @@ public class QuickStartV2IT extends BaseResourceIT { ...@@ -89,7 +89,7 @@ public class QuickStartV2IT extends BaseResourceIT {
AtlasEntity processEntity = atlasClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity(); AtlasEntity processEntity = atlasClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity();
return processEntity; return processEntity;
} }
private void verifyTrait(AtlasEntity table) throws AtlasServiceException { private void verifyTrait(AtlasEntity table) throws AtlasServiceException {
AtlasClassification.AtlasClassifications classfications = atlasClientV2.getClassifications(table.getGuid()); AtlasClassification.AtlasClassifications classfications = atlasClientV2.getClassifications(table.getGuid());
......
...@@ -346,13 +346,13 @@ public abstract class BaseResourceIT { ...@@ -346,13 +346,13 @@ public abstract class BaseResourceIT {
HierarchicalTypeDefinition<TraitType> financeTrait = HierarchicalTypeDefinition<TraitType> financeTrait =
TypesUtil.createTraitTypeDef("finance", ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef("finance", ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> factTrait = HierarchicalTypeDefinition<TraitType> factTrait =
TypesUtil.createTraitTypeDef("Fact", ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef("Fact" + randomString(), ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> etlTrait = HierarchicalTypeDefinition<TraitType> etlTrait =
TypesUtil.createTraitTypeDef("ETL", ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef("ETL" + randomString(), ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> dimensionTrait = HierarchicalTypeDefinition<TraitType> dimensionTrait =
TypesUtil.createTraitTypeDef("Dimension", ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef("Dimension" + randomString(), ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> metricTrait = HierarchicalTypeDefinition<TraitType> metricTrait =
TypesUtil.createTraitTypeDef("Metric", ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef("Metric" + randomString(), ImmutableSet.<String>of());
createType(getTypesDef(ImmutableList.of(enumTypeDefinition), ImmutableList.of(structTypeDefinition), createType(getTypesDef(ImmutableList.of(enumTypeDefinition), ImmutableList.of(structTypeDefinition),
ImmutableList.of(classificationTrait, piiTrait, phiTrait, pciTrait, ImmutableList.of(classificationTrait, piiTrait, phiTrait, pciTrait,
......
...@@ -448,7 +448,10 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -448,7 +448,10 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
String newDBId = dbInstance._getId(); String newDBId = dbInstance._getId();
//Add reference property //Add reference property
addProperty(guid, "db", newDBId); EntityResult entityResult = atlasClientV1.updateEntityAttribute(guid, "db", newDBId);
assertEquals(entityResult.getUpdateEntities().size(), 2);
assertEquals(entityResult.getUpdateEntities().get(0), newDBId);
assertEquals(entityResult.getUpdateEntities().get(1), guid);
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment