You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by yo...@apache.org on 2016/09/07 17:42:13 UTC
[17/52] [abbrv] incubator-eagle git commit: [EAGLE-500] fix
process-stopping issue of mongodb unit test case
[EAGLE-500] fix process-stopping issue of mongodb unit test case
https://issues.apache.org/jira/browse/EAGLE-500
Author: anyway1021 <mw...@apache.org>
Closes #387 from anyway1021/EAGLE-500.
Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/a846c401
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/a846c401
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/a846c401
Branch: refs/heads/master
Commit: a846c401c0b9fad912578cc17b0b0e31d52e983a
Parents: b5fd782
Author: anyway1021 <mw...@apache.org>
Authored: Thu Aug 25 17:44:37 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Thu Aug 25 17:44:37 2016 +0800
----------------------------------------------------------------------
.../service/alert/resource/impl/MongoImplTest.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a846c401/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java
index a48ee7d..95f2682 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java
@@ -25,6 +25,7 @@ import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.process.runtime.Network;
+import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.eagle.alert.coordination.model.*;
import org.apache.eagle.alert.coordination.model.internal.MonitoredStream;
import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment;
@@ -79,7 +80,21 @@ public class MongoImplTest {
@AfterClass
public static void teardown() {
if (mongod != null) {
- mongod.stop();
+ try {
+ mongod.stop();
+ }
+ catch (IllegalStateException e) {
+ // catch this exception for the unstable stopping mongodb
+ // reason: the exception is usually thrown out with below message format when stop() returns null value,
+ // but actually this should have been captured in ProcessControl.stopOrDestroyProcess() by destroying
+ // the process ultimately
+ if (e.getMessage() != null && e.getMessage().matches("^Couldn't kill.*process!.*")) {
+ // if matches, do nothing, just ignore the exception
+ }
+ else {
+ LOG.warn(String.format("Ignored error for stopping mongod process, see stack trace: %s", ExceptionUtils.getStackTrace(e)));
+ }
+ }
mongodExe.stop();
}
}