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
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84:
bundle exec sequel...
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
Hi Jamis,
I think there’s an issue with a test on chapter 6. I own the ebook, version P1.0 Feb. 2019.
This test doesn’t pass for me:
...
New
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
Is the book’s epub format available to read on Google Play Books?
New
Hi, I’m working on the Chapter 8 of the book.
After I add add the point_offset, I’m still able to see acne:
In the image above, I re...
New
@mfazio23
I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New
I am using Android Studio Chipmunk | 2021.2.1 Patch 2
Build #AI-212.5712.43.2112.8815526, built on July 10, 2022
Runtime version: 11.0....
New
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
Other popular topics
Algorithms and data structures are much more than abstract concepts. Mastering them enables you to write code that runs faster and more e...
New
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
This looks like a stunning keycap set :orange_heart:
A LEGENDARY KEYBOARD LIVES ON
When you bought an Apple Macintosh computer in the e...
New
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
Hi folks,
I don’t know if I saw this here but, here’s a new programming language, called Roc
Reminds me a bit of Elm and thus Haskell. ...
New
Author Spotlight
Jamis Buck
@jamis
This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
Author Spotlight:
VM Brasseur
@vmbrasseur
We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
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
Use advanced functional programming principles, practical Domain-Driven Design techniques, and production-ready Elixir code to build scal...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /java
- /haskell
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /zig
- /centos
- /deepseek
- /php
- /scala
- /react-native
- /lisp
- /sublime-text
- /textmate
- /nixos
- /debian
- /agda
- /django
- /deno
- /kubuntu
- /arch-linux
- /nodejs
- /ubuntu
- /revery
- /manjaro
- /spring
- /lua
- /diversity
- /julia
- /markdown
- /c








