Skip to content

Commit

Permalink
Added the Framework version check before the test runs (#574)
Browse files Browse the repository at this point in the history
It is useful when analyzing Jenkins test job results
  • Loading branch information
agozhiy authored and agirish committed Apr 13, 2019
1 parent 457c4be commit 7ea28ba
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ conf/drillTestConfig.properties
*.class
**/target/*
logs/*
git.properties
framework/resources/Datasources/s3minio/minio/minio_data/.minio.sys
framework/resources/Datasources/s3minio/minio/minio_data/tstbucket/tmp/ppruning/
framework/resources/Datasources/s3minio/minio/minio_data/tstbucket/tmp/gitignore
Expand Down
4 changes: 2 additions & 2 deletions bin/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ done
# use the following line when testing apache drill JDBC driver
if [[ $HADOOP_VERSION == *"mapr"* ]]
then
java $DRILL_TEST_FRAMEWORK_JAVA_OPTS -Xss40m -cp conf/:${DRILL_HOME}/jars/jdbc-driver/drill-jdbc-all-${DRILL_VERSION}.jar:framework/target/framework-1.0.0-SNAPSHOT-shaded.jar -Dfs.mapr.bailout.on.library.mismatch=false -Djava.io.tmpdir=/tmp/drill/tests -Djava.security.auth.login.config=/opt/mapr/conf/mapr.login.conf -Dzookeeper.sasl.client=false org.apache.drill.test.framework.TestDriver "${ARGS[@]}"
java $DRILL_TEST_FRAMEWORK_JAVA_OPTS -Xss40m -cp .:conf/:${DRILL_HOME}/jars/jdbc-driver/drill-jdbc-all-${DRILL_VERSION}.jar:framework/target/framework-1.0.0-SNAPSHOT-shaded.jar -Dfs.mapr.bailout.on.library.mismatch=false -Djava.io.tmpdir=/tmp/drill/tests -Djava.security.auth.login.config=/opt/mapr/conf/mapr.login.conf -Dzookeeper.sasl.client=false org.apache.drill.test.framework.TestDriver "${ARGS[@]}"
else
java $DRILL_TEST_FRAMEWORK_JAVA_OPTS -Xss40m -cp conf/:${DRILL_HOME}/jars/jdbc-driver/drill-jdbc-all-${DRILL_VERSION}.jar:framework/target/framework-1.0.0-SNAPSHOT-shaded.jar org.apache.drill.test.framework.TestDriver "${ARGS[@]}"
java $DRILL_TEST_FRAMEWORK_JAVA_OPTS -Xss40m -cp .:conf/:${DRILL_HOME}/jars/jdbc-driver/drill-jdbc-all-${DRILL_VERSION}.jar:framework/target/framework-1.0.0-SNAPSHOT-shaded.jar org.apache.drill.test.framework.TestDriver "${ARGS[@]}"
fi
25 changes: 25 additions & 0 deletions framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.5</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>

<configuration>
<dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.basedir}/../git.properties</generateGitPropertiesFilename>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<gitDescribe>
<always>false</always>
<forceLongFormat>true</forceLongFormat>
</gitDescribe>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ public static void main(String[] args) throws Exception {
}

public int runTests() throws Exception {

LOG.info(DrillTestDefaults.LINE_BREAK +
"\nDRILL TEST FRAMEWORK VERSION\n" +
DrillTestDefaults.LINE_BREAK + "\n" +
Utils.getFrameworkVersion() + "\n" +
DrillTestDefaults.LINE_BREAK + "\n");

List<List<DrillTest>> executionFailureExceptions=Lists.newArrayList();
for(int ii=0;ii<DrillTestDefaults.DRILL_EXCEPTION_REGEXES.length;ii++){
Expand Down
22 changes: 22 additions & 0 deletions framework/src/main/java/org/apache/drill/test/framework/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Resources;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
Expand Down Expand Up @@ -1070,4 +1071,25 @@ public static boolean matches(String actual, String expected) {
}
return true;
}

public static String getFrameworkVersion() {
String commitID = "";
String commitAuthor = "";
String commitEmail = "";
String commitMessage = "";
try {
URL u = Resources.getResource("git.properties");
if (u != null) {
Properties p = new Properties();
p.load(Resources.asByteSource(u).openStream());
commitID = p.getProperty("git.commit.id");
commitAuthor = p.getProperty("git.commit.user.name");
commitEmail = p.getProperty("git.commit.user.email");
commitMessage = p.getProperty("git.commit.message.short");
}
} catch (IOException | IllegalArgumentException e) {
LOG.warn("Failure while trying to load \"git.properties\" file.", e);
}
return String.format("Commit: %s\nAuthor: %s <%s>\n\n%s", commitID, commitAuthor, commitEmail, commitMessage);
}
}

0 comments on commit 7ea28ba

Please sign in to comment.