You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/04/26 09:16:13 UTC
[jira] [Commented] (FLINK-1827) Move test classes in test folders
and fix scope of test dependencies
[ https://issues.apache.org/jira/browse/FLINK-1827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15257678#comment-15257678 ]
ASF GitHub Bot commented on FLINK-1827:
---------------------------------------
Github user stefanobortoli commented on a diff in the pull request:
https://github.com/apache/flink/pull/1915#discussion_r61037816
--- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskManagerStartupTest.java ---
@@ -53,41 +59,55 @@ public void testStartupWhenTaskmanagerActorPortIsUsed() {
blocker = new ServerSocket(0, 50, localAddress);
final int port = blocker.getLocalPort();
- try {
- TaskManager.runTaskManager(
- localHostName,
- ResourceID.generate(),
- port,
- new Configuration(),
+ TaskManager.runTaskManager(localHostName, ResourceID.generate(), port, new Configuration(),
TaskManager.class);
- fail("This should fail with an IOException");
- }
- catch (IOException e) {
- // expected. validate the error message
- assertNotNull(e.getMessage());
- assertTrue(e.getMessage().contains("Address already in use"));
+ fail("This should fail with an IOException");
+
+ } catch (IOException e) {
+ // expected. validate the error messagex
+ List<Throwable> causes = getExceptionCauses(e, new ArrayList<Throwable>());
+ for (Throwable cause : causes) {
+ if (cause instanceof BindException) {
+ throw (BindException) cause;
+ }
}
-
- }
- catch (Exception e) {
+ fail("This should fail with an exception caused by BindException");
+ } catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
- }
- finally {
+ } finally {
if (blocker != null) {
try {
blocker.close();
- }
- catch (IOException e) {
+ } catch (IOException e) {
// no need to log here
}
}
}
}
/**
- * Tests that the TaskManager startup fails synchronously when the I/O directories are
- * not writable.
+ * A utility method to analyze the exceptions and collect the clauses
+ *
+ * @param e
+ * the root exception (Throwable) object
+ * @param causes
+ * the list of exceptions that caused the root exceptions
+ * @return
+ */
+ private List<Throwable> getExceptionCauses(Throwable e, List<Throwable> causes) {
--- End diff --
sure I can do that
> Move test classes in test folders and fix scope of test dependencies
> --------------------------------------------------------------------
>
> Key: FLINK-1827
> URL: https://issues.apache.org/jira/browse/FLINK-1827
> Project: Flink
> Issue Type: Improvement
> Components: Build System
> Affects Versions: 0.9
> Reporter: Flavio Pompermaier
> Priority: Minor
> Labels: test-compile
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> Right now it is not possible to avoid compilation of test classes (-Dmaven.test.skip=true) because some project (e.g. flink-test-utils) requires test classes in non-test sources (e.g. scalatest_${scala.binary.version})
> Test classes should be moved to src/main/test (if Java) and src/test/scala (if scala) and use scope=test for test dependencies
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)