
lessless
Network Programming in Elixir and Erlang: Chat integration tests are failing at random
Title: Network Programming in Elixir and Erlang (p. 56)
Hi,
Thanks for the amazing book, first and foremost.
I found that Chat app integration tests, as they are provided on page 56, are randomly failing when I’m running them multiple times.
For example, all mix test
runs were executed against the same codebase, with no modifications. Some runs succeeded, some failed and failed in different tests.
mix test
Compiling 1 file (.ex)
Generated chat app
16:48:32.613 [info] Started chat server on port 4101
Running ExUnit with seed: 621706, max_cases: 20
.........
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 0 failures
mix test
16:48:34.200 [info] Started chat server on port 4101
Running ExUnit with seed: 208381, max_cases: 20
.........
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 0 failures
mix test
16:48:35.467 [info] Started chat server on port 4101
Running ExUnit with seed: 474408, max_cases: 20
.........
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 0 failures
mix test
16:48:36.701 [info] Started chat server on port 4101
Running ExUnit with seed: 709368, max_cases: 20
......
16:48:36.961 [error] GenServer #PID<0.180.0> terminating
** (FunctionClauseError) no function clause matching in Chat.Connection.handle_info/2
(chat 0.1.0) lib/chat/connection.ex:19: Chat.Connection.handle_info({:tcp_closed, #Port<0.11>}, %Chat.Connection{socket: #Port<0.11>, username: "amy", buffer: ""})
(stdlib 6.2.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
(stdlib 6.2.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:tcp_closed, #Port<0.11>}
State: %Chat.Connection{socket: #Port<0.11>, username: "amy", buffer: ""}
16:48:36.961 [error] GenServer #PID<0.181.0> terminating
** (FunctionClauseError) no function clause matching in Chat.Connection.handle_info/2
(chat 0.1.0) lib/chat/connection.ex:19: Chat.Connection.handle_info({:tcp_closed, #Port<0.12>}, %Chat.Connection{socket: #Port<0.12>, username: "bern", buffer: ""})
(stdlib 6.2.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
(stdlib 6.2.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:tcp_closed, #Port<0.12>}
State: %Chat.Connection{socket: #Port<0.12>, username: "bern", buffer: ""}
16:48:36.961 [error] GenServer #PID<0.179.0> terminating
** (FunctionClauseError) no function clause matching in Chat.Connection.handle_info/2
(chat 0.1.0) lib/chat/connection.ex:19: Chat.Connection.handle_info({:tcp_closed, #Port<0.8>}, %Chat.Connection{socket: #Port<0.8>, username: "jd", buffer: ""})
(stdlib 6.2.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
(stdlib 6.2.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:tcp_closed, #Port<0.8>}
State: %Chat.Connection{socket: #Port<0.8>, username: "jd", buffer: ""}
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:48:55.294 [info] Started chat server on port 4101
Running ExUnit with seed: 303579, max_cases: 20
......
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:48:57.808 [info] Started chat server on port 4101
Running ExUnit with seed: 817244, max_cases: 20
......
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:48:59.453 [info] Started chat server on port 4101
Running ExUnit with seed: 461426, max_cases: 20
......
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:49:00.937 [info] Started chat server on port 4101
Running ExUnit with seed: 944586, max_cases: 20
......
16:49:01.205 [error] GenServer #PID<0.180.0> terminating
** (FunctionClauseError) no function clause matching in Chat.Connection.handle_info/2
(chat 0.1.0) lib/chat/connection.ex:19: Chat.Connection.handle_info({:tcp_closed, #Port<0.10>}, %Chat.Connection{socket: #Port<0.10>, username: "amy", buffer: ""})
(stdlib 6.2.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
(stdlib 6.2.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:tcp_closed, #Port<0.10>}
State: %Chat.Connection{socket: #Port<0.10>, username: "amy", buffer: ""}
16:49:01.205 [error] GenServer #PID<0.181.0> terminating
** (FunctionClauseError) no function clause matching in Chat.Connection.handle_info/2
(chat 0.1.0) lib/chat/connection.ex:19: Chat.Connection.handle_info({:tcp_closed, #Port<0.12>}, %Chat.Connection{socket: #Port<0.12>, username: "bern", buffer: ""})
(stdlib 6.2.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
(stdlib 6.2.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:tcp_closed, #Port<0.12>}
State: %Chat.Connection{socket: #Port<0.12>, username: "bern", buffer: ""}
16:49:01.205 [error] GenServer #PID<0.179.0> terminating
** (FunctionClauseError) no function clause matching in Chat.Connection.handle_info/2
(chat 0.1.0) lib/chat/connection.ex:19: Chat.Connection.handle_info({:tcp_closed, #Port<0.8>}, %Chat.Connection{socket: #Port<0.8>, username: "jd", buffer: ""})
(stdlib 6.2.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
(stdlib 6.2.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:tcp_closed, #Port<0.8>}
State: %Chat.Connection{socket: #Port<0.8>, username: "jd", buffer: ""}
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:49:02.370 [info] Started chat server on port 4101
Running ExUnit with seed: 378187, max_cases: 20
......
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:49:04.997 [info] Started chat server on port 4101
Running ExUnit with seed: 5948, max_cases: 20
......
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:49:08.565 [info] Started chat server on port 4101
Running ExUnit with seed: 573340, max_cases: 20
......
1) test server closes connection ficlient sends register message twice (Chat.IntegrationTest)
test/chat/integration_test.exs:9
Assertion with =~ failed
code: assert log =~ "Invalid Register message"
left: ""
right: "Invalid Register message"
stacktrace:
test/chat/integration_test.exs:21: (test)
..
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 1 failure
mix test
16:49:16.089 [info] Started chat server on port 4101
Running ExUnit with seed: 98240, max_cases: 20
.........
Finished in 0.2 seconds (0.2s async, 0.00s sync)
1 doctest, 8 tests, 0 failures
The repo to reproduce the issue is available at GitHub - lessless/chat: Errata for
Popular Pragmatic Bookshelf topics

page 37
ANTLRInputStream input = new ANTLRInputStream(is);
as of ANTLR 4 .8 should be:
CharStream stream = CharStreams.fromStream(i...
New

Hi @venkats,
It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New

This is as much a suggestion as a question, as a note for others.
Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New

Hi, I have just acquired Michael Fazio’s “Kotlin and Android Development” to learn about game programming for Android. I have a game in p...
New

Hi,
I completed chapter 6 but am getting the following error when running:
thread 'main' panicked at 'Failed to load texture: IoError(O...
New

On page 78 the following code appears:
<%= link_to ‘Destroy’, product,
class: ‘hover:underline’,
method: :delete,
data: { confirm...
New

The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error.
lib/pento_web/live/product_l...
New

Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below:
d...
New

root_layout: {PentoWeb.LayoutView, :root},
This results in the following following error:
no “root” html template defined for PentoWeb...
New

From page 13:
On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New
Other popular topics

If it’s a mechanical keyboard, which switches do you have?
Would you recommend it? Why?
What will your next keyboard be?
Pics always w...
New

Which, if any, games do you play? On what platform?
I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New

Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New

My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New

Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New

API 4
Path:
/user/following/
Method:
GET
Description:
Returns the list of all names of people whom the user follows
Response
[
{ ...
New

The File System Access API with Origin Private File System.
WebKit supports new API that makes it possible for web apps to create, open,...
New

Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New

zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig.
General-purpose programming language and toolchain for maintaini...
New

Get the comprehensive, insider information you need for Rails 8 with the new edition of this award-winning classic.
Sam Ruby @rubys
...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /onivim
- /typescript
- /svelte
- /kotlin
- /crystal
- /c-plus-plus
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /textmate
- /sublime-text
- /lisp
- /debian
- /nixos
- /react-native
- /agda
- /kubuntu
- /arch-linux
- /django
- /ubuntu
- /revery
- /spring
- /manjaro
- /nodejs
- /diversity
- /deno
- /lua
- /julia
- /slackware
- /c