You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ss...@apache.org on 2016/10/17 18:07:47 UTC
hive git commit: HIVE-14958. Improve the 'TestClass' did not produce a TEST-*.xml file message to include list of all qfiles in a batch, batch id. (Siddharth Seth, reviewed by Sergio Peña)
Repository: hive
Updated Branches:
refs/heads/master df6afdd4c -> e9c217fe6
HIVE-14958. Improve the 'TestClass' did not produce a TEST-*.xml file message to include list of all qfiles in a batch, batch id. (Siddharth Seth, reviewed by Sergio Pe�a)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/e9c217fe
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/e9c217fe
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/e9c217fe
Branch: refs/heads/master
Commit: e9c217fe69e1da068579ea3b5a1de02ad11730a3
Parents: df6afdd
Author: Siddharth Seth <ss...@apache.org>
Authored: Mon Oct 17 11:07:34 2016 -0700
Committer: Siddharth Seth <ss...@apache.org>
Committed: Mon Oct 17 11:07:34 2016 -0700
----------------------------------------------------------------------
.../hive/ptest/execution/ExecutionPhase.java | 21 ++++++++++++++++++--
.../ptest/execution/conf/QFileTestBatch.java | 11 ++++++++--
.../ptest/execution/TestExecutionPhase.java | 8 ++++----
.../TestScripts.testPrepGit.approved.txt | 4 ++--
.../TestScripts.testPrepHadoop1.approved.txt | 4 ++--
.../TestScripts.testPrepNone.approved.txt | 4 ++--
.../TestScripts.testPrepSvn.approved.txt | 4 ++--
7 files changed, 40 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/e9c217fe/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/ExecutionPhase.java
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/ExecutionPhase.java b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/ExecutionPhase.java
index 8a64499..2015187 100644
--- a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/ExecutionPhase.java
+++ b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/ExecutionPhase.java
@@ -20,6 +20,7 @@ package org.apache.hive.ptest.execution;
import java.io.File;
import java.io.IOException;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -28,7 +29,9 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import com.google.common.base.Joiner;
import org.apache.hive.ptest.execution.conf.Host;
+import org.apache.hive.ptest.execution.conf.QFileTestBatch;
import org.apache.hive.ptest.execution.conf.TestBatch;
import org.apache.hive.ptest.execution.context.ExecutionContext;
import org.slf4j.Logger;
@@ -116,13 +119,27 @@ public class ExecutionPhase extends Phase {
}
JUnitReportParser parser = new JUnitReportParser(logger, batchLogDir);
executedTests.addAll(parser.getAllExecutedTests());
- failedTests.addAll(parser.getAllFailedTests());
+ for (String failedTest : parser.getAllFailedTests()) {
+ failedTests.add(failedTest + " (batchId=" + batch.getBatchId() + ")");
+ }
+
// if the TEST*.xml was not generated or was corrupt, let someone know
if (parser.getTestClassesWithReportAvailable().size() < batch.getTestClasses().size()) {
Set<String> expTestClasses = new HashSet<>(batch.getTestClasses());
expTestClasses.removeAll(parser.getTestClassesWithReportAvailable());
for (String testClass : expTestClasses) {
- failedTests.add(testClass + " - did not produce a TEST-*.xml file");
+ StringBuilder messageBuilder = new StringBuilder();
+ messageBuilder.append(testClass).append(" - did not produce a TEST-*.xml file (likely timed out)")
+ .append(" (batchId=").append(batch.getBatchId()).append(")");
+ if (batch instanceof QFileTestBatch) {
+ Collection<String> tests = ((QFileTestBatch)batch).getTests();
+ if (tests.size() != 0) {
+ messageBuilder.append("\n\t[");
+ messageBuilder.append(Joiner.on(",").join(tests));
+ messageBuilder.append("]");
+ }
+ }
+ failedTests.add(messageBuilder.toString());
}
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/e9c217fe/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java
index 405c44b..ced83bf 100644
--- a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java
+++ b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java
@@ -20,11 +20,13 @@ package org.apache.hive.ptest.execution.conf;
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
public class QFileTestBatch extends TestBatch {
@@ -33,7 +35,7 @@ public class QFileTestBatch extends TestBatch {
private final String queryFilesProperty;
private final String name;
private final String moduleName;
- private final Set<String> tests;
+ private final List<String> tests;
private final boolean isParallel;
public QFileTestBatch(AtomicInteger batchIdCounter, String testCasePropertyName, String driver,
@@ -43,7 +45,8 @@ public class QFileTestBatch extends TestBatch {
this.testCasePropertyName = testCasePropertyName;
this.driver = driver;
this.queryFilesProperty = queryFilesProperty;
- this.tests = tests;
+ // Store as a list to have a consistent order between getTests, and the test argument generation.
+ this.tests = Lists.newArrayList(tests);
String name = Joiner.on("-").join(getBatchId(), driver, Joiner.on("-").join(
Iterators.toArray(Iterators.limit(tests.iterator(), 3), String.class)));
if(tests.size() > 3) {
@@ -66,6 +69,10 @@ public class QFileTestBatch extends TestBatch {
Joiner.on(",").join(tests));
}
+ public Collection<String> getTests() {
+ return Collections.unmodifiableList(tests);
+ }
+
@Override
public String toString() {
return "QFileTestBatch [batchId=" + getBatchId() + ", size=" + tests.size() + ", driver=" +
http://git-wip-us.apache.org/repos/asf/hive/blob/e9c217fe/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestExecutionPhase.java
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestExecutionPhase.java b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestExecutionPhase.java
index 558d5ae..24c811e 100644
--- a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestExecutionPhase.java
+++ b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestExecutionPhase.java
@@ -126,7 +126,7 @@ public class TestExecutionPhase extends AbstractTestPhase {
Assert.assertEquals(1, sshCommandExecutor.getMatchCount());
Approvals.verify(getExecutedCommands());
Assert.assertEquals(Sets.newHashSet("SomeTest." + QFILENAME), executedTests);
- Assert.assertEquals(Sets.newHashSet("SomeTest." + QFILENAME), failedTests);
+ Assert.assertEquals(Sets.newHashSet("SomeTest." + QFILENAME + " (batchId=1)"), failedTests);
}
@Test
public void testPassingUnitTest() throws Throwable {
@@ -147,10 +147,10 @@ public class TestExecutionPhase extends AbstractTestPhase {
Assert.assertEquals(1, sshCommandExecutor.getMatchCount());
Approvals.verify(getExecutedCommands());
Assert.assertEquals(Sets.newHashSet("SomeTest." + QFILENAME), executedTests);
- Assert.assertEquals(Sets.newHashSet("SomeTest." + QFILENAME), failedTests);
+ Assert.assertEquals(Sets.newHashSet("SomeTest." + QFILENAME + " (batchId=1)"), failedTests);
}
- @Test(timeout = 2000000)
+ @Test(timeout = 20000)
public void testTimedOutUnitTest() throws Throwable {
setupUnitTest(3);
copyTestOutput("SomeTest-success.xml", succeededLogDir, testBatch.getName(), "TEST-TestClass-0.xml");
@@ -158,6 +158,6 @@ public class TestExecutionPhase extends AbstractTestPhase {
getPhase().execute();
Approvals.verify(getExecutedCommands());
Assert.assertEquals(1, failedTests.size());
- Assert.assertEquals("TestClass-2 - did not produce a TEST-*.xml file", failedTests.iterator().next());
+ Assert.assertEquals("TestClass-2 - did not produce a TEST-*.xml file (likely timed out) (batchId=1)", failedTests.iterator().next());
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hive/blob/e9c217fe/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepGit.approved.txt
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepGit.approved.txt b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepGit.approved.txt
index 29d2413..ecdd063 100644
--- a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepGit.approved.txt
+++ b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepGit.approved.txt
@@ -87,11 +87,11 @@ cd /some/working/dir/
if [[ "${buildTool}" == "maven" ]]
then
rm -rf /some/working/dir/maven/org/apache/hive
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven -X -Phadoop-2
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven -X -Phadoop-2
if [[ -d "itests" ]]
then
cd itests
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven -X -Phadoop-2
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven -X -Phadoop-2
fi
elif [[ "${buildTool}" == "ant" ]]
then
http://git-wip-us.apache.org/repos/asf/hive/blob/e9c217fe/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepHadoop1.approved.txt
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepHadoop1.approved.txt b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepHadoop1.approved.txt
index 361b9bb..650a5b9 100644
--- a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepHadoop1.approved.txt
+++ b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepHadoop1.approved.txt
@@ -99,11 +99,11 @@ cd /some/working/dir/
cd ..
fi
done
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
if [[ -d "itests" ]]
then
cd itests
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
fi
elif [[ "maven" == "ant" ]]
then
http://git-wip-us.apache.org/repos/asf/hive/blob/e9c217fe/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepNone.approved.txt
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepNone.approved.txt b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepNone.approved.txt
index 5f494ee..4678ebd 100644
--- a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepNone.approved.txt
+++ b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepNone.approved.txt
@@ -87,11 +87,11 @@ cd /some/working/dir/
if [[ "ant" == "maven" ]]
then
rm -rf /some/working/dir/maven/org/apache/hive
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
if [[ -d "itests" ]]
then
cd itests
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
fi
elif [[ "ant" == "ant" ]]
then
http://git-wip-us.apache.org/repos/asf/hive/blob/e9c217fe/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepSvn.approved.txt
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepSvn.approved.txt b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepSvn.approved.txt
index 9de17af..4d428f4 100644
--- a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepSvn.approved.txt
+++ b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testPrepSvn.approved.txt
@@ -87,11 +87,11 @@ cd /some/working/dir/
if [[ "maven" == "maven" ]]
then
rm -rf /some/working/dir/maven/org/apache/hive
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
if [[ -d "itests" ]]
then
cd itests
- mvn -B clean install -DskipTests -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
+ mvn -B clean install -DskipTests -T 4 -q -Dmaven.repo.local=/some/working/dir/maven $mavenArgs $mavenBuildArgs
fi
elif [[ "maven" == "ant" ]]
then