From 9ad8b2e99700e8154920eaf69cd2f195cb40e390 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Fri, 20 Jan 2017 11:35:56 +0100 Subject: [PATCH 1/2] Don't shutdown ActorSystem in tests * changes due to new coordinated shutdown behavior --- .../src/test/resources/reference.conf | 4 ++++ .../src/test/resources/reference.conf | 4 ++++ .../src/test/resources/reference.conf | 4 ++++ .../src/test/resources/reference.conf | 4 ++++ .../src/test/resources/reference.conf | 4 ++++ .../akka-sample-remote-java/src/test/resources/reference.conf | 4 ++++ .../src/test/resources/reference.conf | 4 ++++ 7 files changed, 28 insertions(+) create mode 100644 akka-samples/akka-sample-cluster-java/src/test/resources/reference.conf create mode 100644 akka-samples/akka-sample-cluster-scala/src/test/resources/reference.conf create mode 100644 akka-samples/akka-sample-distributed-data-java/src/test/resources/reference.conf create mode 100644 akka-samples/akka-sample-distributed-data-scala/src/test/resources/reference.conf create mode 100644 akka-samples/akka-sample-multi-node-scala/src/test/resources/reference.conf create mode 100644 akka-samples/akka-sample-remote-java/src/test/resources/reference.conf create mode 100644 akka-samples/akka-sample-remote-scala/src/test/resources/reference.conf diff --git a/akka-samples/akka-sample-cluster-java/src/test/resources/reference.conf b/akka-samples/akka-sample-cluster-java/src/test/resources/reference.conf new file mode 100644 index 0000000000..90492329b7 --- /dev/null +++ b/akka-samples/akka-sample-cluster-java/src/test/resources/reference.conf @@ -0,0 +1,4 @@ +# Don't terminate ActorSystem in tests +akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off +akka.coordinated-shutdown.terminate-actor-system = off +akka.cluster.run-coordinated-shutdown-when-down = off diff --git a/akka-samples/akka-sample-cluster-scala/src/test/resources/reference.conf b/akka-samples/akka-sample-cluster-scala/src/test/resources/reference.conf new file mode 100644 index 0000000000..90492329b7 --- /dev/null +++ b/akka-samples/akka-sample-cluster-scala/src/test/resources/reference.conf @@ -0,0 +1,4 @@ +# Don't terminate ActorSystem in tests +akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off +akka.coordinated-shutdown.terminate-actor-system = off +akka.cluster.run-coordinated-shutdown-when-down = off diff --git a/akka-samples/akka-sample-distributed-data-java/src/test/resources/reference.conf b/akka-samples/akka-sample-distributed-data-java/src/test/resources/reference.conf new file mode 100644 index 0000000000..90492329b7 --- /dev/null +++ b/akka-samples/akka-sample-distributed-data-java/src/test/resources/reference.conf @@ -0,0 +1,4 @@ +# Don't terminate ActorSystem in tests +akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off +akka.coordinated-shutdown.terminate-actor-system = off +akka.cluster.run-coordinated-shutdown-when-down = off diff --git a/akka-samples/akka-sample-distributed-data-scala/src/test/resources/reference.conf b/akka-samples/akka-sample-distributed-data-scala/src/test/resources/reference.conf new file mode 100644 index 0000000000..90492329b7 --- /dev/null +++ b/akka-samples/akka-sample-distributed-data-scala/src/test/resources/reference.conf @@ -0,0 +1,4 @@ +# Don't terminate ActorSystem in tests +akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off +akka.coordinated-shutdown.terminate-actor-system = off +akka.cluster.run-coordinated-shutdown-when-down = off diff --git a/akka-samples/akka-sample-multi-node-scala/src/test/resources/reference.conf b/akka-samples/akka-sample-multi-node-scala/src/test/resources/reference.conf new file mode 100644 index 0000000000..90492329b7 --- /dev/null +++ b/akka-samples/akka-sample-multi-node-scala/src/test/resources/reference.conf @@ -0,0 +1,4 @@ +# Don't terminate ActorSystem in tests +akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off +akka.coordinated-shutdown.terminate-actor-system = off +akka.cluster.run-coordinated-shutdown-when-down = off diff --git a/akka-samples/akka-sample-remote-java/src/test/resources/reference.conf b/akka-samples/akka-sample-remote-java/src/test/resources/reference.conf new file mode 100644 index 0000000000..90492329b7 --- /dev/null +++ b/akka-samples/akka-sample-remote-java/src/test/resources/reference.conf @@ -0,0 +1,4 @@ +# Don't terminate ActorSystem in tests +akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off +akka.coordinated-shutdown.terminate-actor-system = off +akka.cluster.run-coordinated-shutdown-when-down = off diff --git a/akka-samples/akka-sample-remote-scala/src/test/resources/reference.conf b/akka-samples/akka-sample-remote-scala/src/test/resources/reference.conf new file mode 100644 index 0000000000..90492329b7 --- /dev/null +++ b/akka-samples/akka-sample-remote-scala/src/test/resources/reference.conf @@ -0,0 +1,4 @@ +# Don't terminate ActorSystem in tests +akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off +akka.coordinated-shutdown.terminate-actor-system = off +akka.cluster.run-coordinated-shutdown-when-down = off From 611dc932619c37c7ffe478229becc820be9f0311 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Fri, 20 Jan 2017 13:25:29 +0100 Subject: [PATCH 2/2] add note about CoordinatedShutdown and tests, #21537 --- akka-docs/rst/java/lambda-actors.rst | 8 ++++++++ akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst | 11 ++++++++++- akka-docs/rst/scala/actors.rst | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/akka-docs/rst/java/lambda-actors.rst b/akka-docs/rst/java/lambda-actors.rst index db4cbc6251..ca451c71f9 100644 --- a/akka-docs/rst/java/lambda-actors.rst +++ b/akka-docs/rst/java/lambda-actors.rst @@ -833,6 +833,14 @@ those shutting down Akka Remoting (Artery). .. includecode:: code/docs/actorlambda/ActorDocTest.java#coordinated-shutdown-jvm-hook +For some tests it might be undesired to terminate the ``ActorSystem`` via ``CoordinatedShutdown``. +You can disable that by adding the following to the configuration of the ``ActorSystem`` that is +used in the test:: + + # Don't terminate ActorSystem via CoordinatedShutdown in tests + akka.coordinated-shutdown.terminate-actor-system = off + akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off + akka.cluster.run-coordinated-shutdown-when-down = off .. _actor-hotswap-lambda: diff --git a/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst b/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst index 98516ff290..935e0c09ca 100644 --- a/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst +++ b/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst @@ -102,7 +102,16 @@ read the documentation for the Coordinated Shutdown and revisit your own impleme Most likely your implementation will not be needed any more or it can be simplified. More information can be found in the :ref:`documentation for Scala ` or -:ref:`documentation for Java ` +:ref:`documentation for Java ` + +For some tests it might be undesired to terminate the ``ActorSystem`` via ``CoordinatedShutdown``. +You can disable that by adding the following to the configuration of the ``ActorSystem`` that is +used in the test:: + + # Don't terminate ActorSystem via CoordinatedShutdown in tests + akka.coordinated-shutdown.terminate-actor-system = off + akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off + akka.cluster.run-coordinated-shutdown-when-down = off Cluster Management Command Line Tool ------------------------------------ diff --git a/akka-docs/rst/scala/actors.rst b/akka-docs/rst/scala/actors.rst index 33bd4c404a..2c44eb2ba9 100644 --- a/akka-docs/rst/scala/actors.rst +++ b/akka-docs/rst/scala/actors.rst @@ -854,6 +854,14 @@ those shutting down Akka Remoting (Artery). .. includecode:: code/docs/actor/ActorDocSpec.scala#coordinated-shutdown-jvm-hook +For some tests it might be undesired to terminate the ``ActorSystem`` via ``CoordinatedShutdown``. +You can disable that by adding the following to the configuration of the ``ActorSystem`` that is +used in the test:: + + # Don't terminate ActorSystem via CoordinatedShutdown in tests + akka.coordinated-shutdown.terminate-actor-system = off + akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off + akka.cluster.run-coordinated-shutdown-when-down = off .. _Actor.HotSwap: