You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/05/14 00:32:44 UTC
[GitHub] [druid] ccaominh commented on a change in pull request #9863: Enforce code coverage
ccaominh commented on a change in pull request #9863:
URL: https://github.com/apache/druid/pull/9863#discussion_r424804344
##########
File path: .travis.yml
##########
@@ -136,20 +135,51 @@ jobs:
- &test_processing_module
name: "(openjdk8) processing module test"
- env: &processing_env
+ env:
- MAVEN_PROJECTS='processing'
- before_script: &setup_java_test
+ before_script:
+ - export DRUID_USE_DEFAULT_VALUE_FOR_NULL=true
+ script:
- unset _JAVA_OPTIONS
- script: &run_java_test
# Set MAVEN_OPTS for Surefire launcher. Skip remoteresources to avoid intermittent connection timeouts when
# resolving the SIGAR dependency.
- >
MAVEN_OPTS='-Xmx800m' ${MVN} test -pl ${MAVEN_PROJECTS}
- ${MAVEN_SKIP} -Dremoteresources.skip=true
+ ${MAVEN_SKIP} -Dremoteresources.skip=true -Ddruid.generic.useDefaultValueForNull=${DRUID_USE_DEFAULT_VALUE_FOR_NULL}
- sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
- free -m
- after_success: &upload_java_unit_test_coverage
- ${MVN} -pl ${MAVEN_PROJECTS} jacoco:report
+ # Add merge target branch to determine diff (see https://github.com/travis-ci/travis-ci/issues/6069)
+ - echo "TRAVIS_BRANCH=${TRAVIS_BRANCH}" # for debugging
+ - git remote set-branches --add origin ${TRAVIS_BRANCH} && git fetch
+ # Determine the modified files that match the maven projects being tested
+ - all_files="$(git diff --name-only origin/${TRAVIS_BRANCH}...HEAD | grep "\.java$" || [[ $? == 1 ]])"
+ - for f in ${all_files}; do echo $f; done # for debugging
+ - >
+ if [[ "${MAVEN_PROJECTS}" = \!* ]]; then
+ regex="${MAVEN_PROJECTS:1}";
+ regex="^${regex//,\!/\\|^}";
+ project_files="$(echo "${all_files}" | grep -v "${regex}" || [[ $? == 1 ]])";
+ else
+ regex="^${MAVEN_PROJECTS//,/\\|^}";
+ project_files="$(echo "${all_files}" | grep "${regex}" || [[ $? == 1 ]])";
+ fi
+ - for f in ${project_files}; do echo $f; done # for debugging
+ # Check diff code coverage for the maven projects being tested (retry install in case of network error)
+ - >
+ if [ -n "${project_files}" ]; then
+ travis_retry npm install @connectis/diff-test-coverage@1.5.3
+ && git diff origin/${TRAVIS_BRANCH}...HEAD -- ${project_files}
+ | node_modules/.bin/diff-test-coverage
+ --coverage "**/target/site/jacoco/jacoco.xml"
+ --type jacoco
+ --line-coverage 65
Review comment:
The `before_script` section that exports a variable is differs for the various jobs. Keeping the threshold here is nice for having defined in one place.
##########
File path: benchmarks/pom.xml
##########
@@ -220,6 +220,13 @@
<skip>true</skip>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip> <!-- ignore non-production code -->
Review comment:
Jacoco coverage isn't collected for the integration tests.
##########
File path: .travis.yml
##########
@@ -136,20 +135,51 @@ jobs:
- &test_processing_module
name: "(openjdk8) processing module test"
- env: &processing_env
+ env:
- MAVEN_PROJECTS='processing'
- before_script: &setup_java_test
+ before_script:
+ - export DRUID_USE_DEFAULT_VALUE_FOR_NULL=true
+ script:
- unset _JAVA_OPTIONS
- script: &run_java_test
# Set MAVEN_OPTS for Surefire launcher. Skip remoteresources to avoid intermittent connection timeouts when
# resolving the SIGAR dependency.
- >
MAVEN_OPTS='-Xmx800m' ${MVN} test -pl ${MAVEN_PROJECTS}
- ${MAVEN_SKIP} -Dremoteresources.skip=true
+ ${MAVEN_SKIP} -Dremoteresources.skip=true -Ddruid.generic.useDefaultValueForNull=${DRUID_USE_DEFAULT_VALUE_FOR_NULL}
- sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
- free -m
- after_success: &upload_java_unit_test_coverage
- ${MVN} -pl ${MAVEN_PROJECTS} jacoco:report
+ # Add merge target branch to determine diff (see https://github.com/travis-ci/travis-ci/issues/6069)
+ - echo "TRAVIS_BRANCH=${TRAVIS_BRANCH}" # for debugging
+ - git remote set-branches --add origin ${TRAVIS_BRANCH} && git fetch
+ # Determine the modified files that match the maven projects being tested
+ - all_files="$(git diff --name-only origin/${TRAVIS_BRANCH}...HEAD | grep "\.java$" || [[ $? == 1 ]])"
+ - for f in ${all_files}; do echo $f; done # for debugging
+ - >
+ if [[ "${MAVEN_PROJECTS}" = \!* ]]; then
+ regex="${MAVEN_PROJECTS:1}";
+ regex="^${regex//,\!/\\|^}";
+ project_files="$(echo "${all_files}" | grep -v "${regex}" || [[ $? == 1 ]])";
+ else
+ regex="^${MAVEN_PROJECTS//,/\\|^}";
+ project_files="$(echo "${all_files}" | grep "${regex}" || [[ $? == 1 ]])";
+ fi
+ - for f in ${project_files}; do echo $f; done # for debugging
Review comment:
Travis already echos the command to the log: https://travis-ci.org/github/ccaominh/druid/jobs/686402944#L5741
Does that accomplish what you had in mind?
##########
File path: .travis.yml
##########
@@ -136,20 +135,51 @@ jobs:
- &test_processing_module
name: "(openjdk8) processing module test"
- env: &processing_env
+ env:
- MAVEN_PROJECTS='processing'
- before_script: &setup_java_test
+ before_script:
+ - export DRUID_USE_DEFAULT_VALUE_FOR_NULL=true
+ script:
- unset _JAVA_OPTIONS
- script: &run_java_test
# Set MAVEN_OPTS for Surefire launcher. Skip remoteresources to avoid intermittent connection timeouts when
# resolving the SIGAR dependency.
- >
MAVEN_OPTS='-Xmx800m' ${MVN} test -pl ${MAVEN_PROJECTS}
- ${MAVEN_SKIP} -Dremoteresources.skip=true
+ ${MAVEN_SKIP} -Dremoteresources.skip=true -Ddruid.generic.useDefaultValueForNull=${DRUID_USE_DEFAULT_VALUE_FOR_NULL}
- sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
- free -m
- after_success: &upload_java_unit_test_coverage
- ${MVN} -pl ${MAVEN_PROJECTS} jacoco:report
+ # Add merge target branch to determine diff (see https://github.com/travis-ci/travis-ci/issues/6069)
+ - echo "TRAVIS_BRANCH=${TRAVIS_BRANCH}" # for debugging
+ - git remote set-branches --add origin ${TRAVIS_BRANCH} && git fetch
+ # Determine the modified files that match the maven projects being tested
+ - all_files="$(git diff --name-only origin/${TRAVIS_BRANCH}...HEAD | grep "\.java$" || [[ $? == 1 ]])"
+ - for f in ${all_files}; do echo $f; done # for debugging
Review comment:
Travis already echos the command to the log: https://travis-ci.org/github/ccaominh/druid/jobs/686402944#L5731
Does that accomplish what you had in mind?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org