
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 20: … protoc command…
I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New

This test is broken right out of the box…
— FAIL: TestAgent (7.82s)
agent_test.go:77:
Error Trace: agent_test.go:77
agent_test.go:...
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

The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New

When I try the command to create a pair of migration files I get an error.
user=> (create-migration "guestbook")
Execution error (Ill...
New

When installing Cards as an editable package, I get the following error:
ERROR: File “setup.py” not found. Directory cannot be installe...
New

Hi,
I am getting an error I cannot figure out on my test.
I have what I think is the exact code from the book, other than I changed “us...
New

Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
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

Modern front-end development for Rails, second edition - Struggling to get the first chapter to work
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New
Other popular topics

Hello Devtalk World!
Please let us know a little about who you are and where you’re from :nerd_face:
New

What chair do you have while working… and why?
Is there a ‘best’ type of chair or working position for developers?
New

We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New

I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New

In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first:
asdf plugin-upd...
New

Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New

Was just curious to see if any were around, found this one:
I got 51/100:
Not sure if it was meant to buy I am sure at times the b...
New

I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New

This is a very quick guide, you just need to:
Download LM Studio: https://lmstudio.ai/
Click on search
Type DeepSeek, then select the o...
New

Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
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
- /crystal
- /kotlin
- /c-plus-plus
- /tailwind
- /gleam
- /react
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /lisp
- /sublime-text
- /textmate
- /nixos
- /debian
- /react-native
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /ubuntu
- /spring
- /manjaro
- /nodejs
- /diversity
- /lua
- /julia
- /c
- /slackware
- /markdown