5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-04 01:32:20 +08:00

SQOOP-1991: Sqoop2: Define slow category in integration tests

(Abraham Elmahrek via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2015-01-23 12:25:10 -08:00
parent c8dbec4813
commit 21a44fc15b
2 changed files with 51 additions and 9 deletions

View File

@ -255,18 +255,26 @@ def find_all_files(top):
for f in files:
yield os.path.join(root, f)
def mvn_test(result, output_dir):
run_mvn_test("test", "unit", result, output_dir)
def mvn_test(result, output_dir, slow):
run_mvn_test("test", "unit", result, output_dir, slow)
def mvn_integration(result, output_dir):
run_mvn_test("integration-test -pl test", "integration", result, output_dir)
def mvn_integration(result, output_dir, slow):
run_mvn_test("integration-test -pl test", "integration", result, output_dir, slow)
def run_mvn_test(command, test_type, result, output_dir):
rc = execute("mvn %s 1>%s/test_%s.txt 2>&1" % (command, output_dir, test_type))
def run_mvn_test(command, test_type, result, output_dir, slow):
if slow:
command += " -Pslow,hadoop200"
test_file_name = "%s_slow" % test_type
test_type = "slow %s" % test_type
else:
test_file_name = "%s_fast" % test_type
test_type = "fast %s" % test_type
rc = execute("mvn %s 1>%s/test_%s.txt 2>&1" % (command, output_dir, test_file_name))
if rc == 0:
result.success("All %s tests passed" % test_type)
else:
result.error("Some %s tests failed (%s)" % (test_type, jenkins_file_link_for_jira("report", "test_%s.txt" % test_type)))
result.error("Some %s tests failed (%s)" % (test_type, jenkins_file_link_for_jira("report", "test_%s.txt" % test_file_name)))
failed_tests = []
for path in list(find_all_files(".")):
file_name = os.path.basename(path)
@ -449,8 +457,10 @@ def post_jira_comment_and_exit():
mvn_rat(result, output_dir)
mvn_install(result, output_dir)
if run_tests:
mvn_test(result, output_dir)
mvn_integration(result, output_dir)
mvn_test(result, output_dir, slow=False)
mvn_test(result, output_dir, slow=True)
mvn_integration(result, output_dir, slow=False)
mvn_integration(result, output_dir, slow=True)
else:
result.info("patch applied and built but tests did not execute")

32
pom.xml
View File

@ -138,6 +138,10 @@ limitations under the License.
<profile>
<id>fast</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
@ -147,6 +151,14 @@ limitations under the License.
<excludedGroups>slow</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<excludedGroups>slow</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
@ -154,6 +166,12 @@ limitations under the License.
<profile>
<id>slow</id>
<activation>
<property>
<name>slow</name>
</property>
</activation>
<build>
<plugins>
<plugin>
@ -163,6 +181,14 @@ limitations under the License.
<groups>slow</groups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>slow</groups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
@ -687,6 +713,12 @@ limitations under the License.
</properties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</pluginManagement>