
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

As per the title, thanks.
New

Hello Brian,
I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New

Title: Web Development with Clojure, Third Edition, pg 116
Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New

Title: Web Development with Clojure, Third Edition - migrations/create not working: p159
When I execute the command:
user=> (create-...
New

Title: Hands-On Rust (Chap 8 (Adding a Heads Up Display)
It looks like
.with_simple_console_no_bg(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
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

I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint.
As entered, the SwitchCompat changes color to hol...
New

When running tox for the first time, I got the following error:
ERROR: InterpreterNotFound: python3.10
I realised that I was running ...
New

Is the book’s epub format available to read on Google Play Books?
New

Hi all,
currently I wonder how the Tailwind colours work (or don’t work).
For example, in app/views/layouts/application.html.erb I have...
New
Other popular topics

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

poll
poll
Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New

There’s a whole world of custom keycaps out there that I didn’t know existed!
Check out all of our Keycaps threads here:
https://forum....
New

Just done a fresh install of macOS Big Sur and on installing Erlang I am getting:
asdf install erlang 23.1.2
Configure failed.
checking ...
New

If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New

Use WebRTC to build web applications that stream media and data in real time directly from one user to another, all in the browser.
...
New

A Brief Review of the Minisforum V3 AMD Tablet.
Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New

Fight complexity and reclaim the original spirit of agility by learning to simplify how you develop software. The result: a more humane a...
New

A concise guide to MySQL 9 database administration, covering fundamental concepts, techniques, and best practices.
Neil Smyth
MySQL...
New

Ok, well here are some thoughts and opinions on some of the ergonomic keyboards I have, I guess like mini review of each that I use enoug...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /rails
- /python
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /haskell
- /emacs
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /crystal
- /c-plus-plus
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /opensuse
- /html
- /centos
- /php
- /deepseek
- /zig
- /scala
- /lisp
- /textmate
- /sublime-text
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /ubuntu
- /revery
- /manjaro
- /spring
- /nodejs
- /diversity
- /lua
- /deno
- /julia
- /slackware
- /c