Repository: phoenixframework/phoenix
Pull request #2830 (2018-04-05 18:49:31)

Update docs about async tests
The section warning about async tests for tests involving a database
was a little confusing to people since it's pretty out dated. This
language was introduce almost [3 years ago](https://github.com/phoenixframework/phoenix/commit/2b456abcea782684861f466d932b451b37279945),
back when async tests touching the database _were_ dangerous. Now that
this is no longer the case thanks to Ecto 2.0, this should be updated
in the guides.


Patch:
diff --git a/guides/docs/deployment/heroku.md b/guides/docs/deployment/heroku.md
index afe255b1c..f417fe6b2 100644
--- a/guides/docs/deployment/heroku.md
+++ b/guides/docs/deployment/heroku.md
@@ -21,8 +21,8 @@ Heroku is a great platform and Elixir performs well on it. However, you may run
 - In-memory state such as those in [Agents](https://elixir-lang.org/getting-started/mix-otp/agent.html), [GenServers](https://elixir-lang.org/getting-started/mix-otp/genserver.html), and [ETS](https://elixir-lang.org/getting-started/mix-otp/ets.html) will be lost every 24 hours.
     - Heroku [restarts dynos](https://devcenter.heroku.com/articles/dynos#restarting) every 24 hours regardless of whether the node is healthy.
 
-- [Remote shells](https://hexdocs.pm/iex/IEx.html#module-remote-shells) and remote observer are not possible.
-    - Heroku does not allow SSH access to your dynos so you can not inspect, debug, or trace your production nodes using things like [the built-in Observer](https://elixir-lang.org/getting-started/mix-otp/supervisor-and-application.html#observer).
+- [the built-in Observer](https://elixir-lang.org/getting-started/debugging.html#observer) can't be used with Heroku.
+    - Heroku does allow for connection into your dyno, but you won't be able to use the observer to watch the state of your dyno.
 
 If you are just getting started or you don't expect to use the features above, Heroku should be enough for your needs. For instance, if you are migrating an existing application running on Heroku to Phoenix, keeping a similar set of features, Elixir will perform just as well or even better than your current stack.
 
@@ -197,7 +197,7 @@ This ensures that any idle connections are closed by Phoenix before they reach H
 Lastly, we'll need to create a [Procfile](https://devcenter.heroku.com/articles/procfile) (a text file called "Procfile" in the root of our project’s folder) with the following line:
 
 ```
-web: MIX_ENV=prod mix phx.server
+web: MIX_ENV=prod elixir --sname server -S mix phx.server
 ```
 
 ## Creating Environment Variables in Heroku
@@ -351,6 +351,16 @@ $ heroku run "POOL_SIZE=2 mix ecto.migrate"
 
 And that's it!
 
+## Connecting to your dyno
+
+Heroku gives you the ability to connect to your dyno with an iex shell which allows running Elixir code such as database queries.
+
+- Connect to the dyno with `heroku ps:exec`
+note that if you have several applications on the same repository you will need to specify the app name or the remote name with `--app APP_NAME` or `--remote REMOTE_NAME`
+- Launch an iex session with `iex --sname console --remsh server@${HOSTNAME}`
+
+You have an iex session into your dyno!
+
 ## Useful Heroku Commands
 
 We can look at the logs of our application by running the following command in our project directory:


Test patch:
diff --git a/guides/docs/testing/testing.md b/guides/docs/testing/testing.md
index cee74e067..36af6a247 100644
--- a/guides/docs/testing/testing.md
+++ b/guides/docs/testing/testing.md
@@ -96,7 +96,7 @@ defmodule HelloWeb.ErrorViewTest do
 end
 ```
 
-`HelloWeb.ErrorViewTest` sets `async: true` which means that this test case will be run in parallel with other test cases. While individual tests within the case still run serially, this can greatly increase overall test speeds. This works because none of the tests access any resources which share state, such as a database. If we set `async: true` for a test case which does access a database, different test processes might modify the same data, corrupting the test results.
+`HelloWeb.ErrorViewTest` sets `async: true` which means that this test case will be run in parallel with other test cases. While individual tests within the case still run serially, this can greatly increase overall test speeds. It is possible to encounter strange behavior with asynchronous tests, but thanks to the [`Ecto.Adapters.SQL.Sandbox`](https://hexdocs.pm/ecto/Ecto.Adapters.SQL.Sandbox.html), async tests involving a database can be done without worry. This means that the vast majority of tests in your Phoenix application will be able to be run asynchronously.
 
 It also imports `Phoenix.View` in order to use the `render_to_string/3` function. With that, all the assertions can be simple string equality tests.