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
Hi everyone!
There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New
Page 28: It implements io.ReaderAt on the store type.
Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt?
...
New
When trying to generate the protobuf .go file, I receive this error:
Unknown flag: --go_opt
libprotoc 3.12.3
MacOS 11.3.1
Googling ...
New
Running mix deps.get in the sensor_hub directory fails with the following error:
** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
Is the book’s epub format available to read on Google Play Books?
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’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
Modern Front-End Development for Rails - application does not start after run bin/setup (page xviii)
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1:
programming_ML/code/03_...
New
root_layout: {PentoWeb.LayoutView, :root},
This results in the following following error:
no “root” html template defined for PentoWeb...
New
Other popular topics
Brace yourself for a fun challenge: build a photorealistic 3D renderer from scratch! In just a couple of weeks, build a ray tracer that r...
New
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
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
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face:
https://on...
New
Saw this on TikTok of all places! :lol:
Anyone heard of them before?
Lite:
New
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol:
bre...
New
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
Author Spotlight
Rebecca Skinner
@RebeccaSkinner
Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
Author Spotlight
Erin Dees
@undees
Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /rails
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /crystal
- /c-plus-plus
- /tailwind
- /react
- /gleam
- /ocaml
- /elm
- /flutter
- /vscode
- /ash
- /opensuse
- /html
- /centos
- /php
- /deepseek
- /zig
- /scala
- /lisp
- /textmate
- /sublime-text
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /deno
- /revery
- /ubuntu
- /nodejs
- /spring
- /manjaro
- /diversity
- /lua
- /julia
- /c
- /slackware







