elixir-plug / plug_cowboy

Plug adapter for the Cowboy web server
Other
243 stars 48 forks source link

`mix test` errors in Elixir 1.13.3 and Erlang/OTP 24.2.2 #80

Closed kianmeng closed 2 years ago

kianmeng commented 2 years ago
$ mix test
warning: use Mix.Config is deprecated. Use the Config module instead
  config/config.exs:1

* creating test/fixtures/ssl/server_key.pem
* creating test/fixtures/ssl/server_key_enc.pem
* creating test/fixtures/ssl/other_key.pem
* creating test/fixtures/ssl/other_key_enc.pem
* creating test/fixtures/ssl/client_key.pem
* creating test/fixtures/ssl/client_key_enc.pem
* creating test/fixtures/ssl/cacerts.pem
* creating test/fixtures/ssl/alternate_cacerts.pem
* creating test/fixtures/ssl/chain.pem
* creating test/fixtures/ssl/ca_and_chain.pem
* creating test/fixtures/ssl/expired_chain.pem
* creating test/fixtures/ssl/revoked_chain.pem
* creating test/fixtures/ssl/alternate_chain.pem
* creating test/fixtures/ssl/valid.pem
* creating test/fixtures/ssl/wildcard.pem
* creating test/fixtures/ssl/expired.pem
* creating test/fixtures/ssl/revoked.pem
* creating test/fixtures/ssl/selfsigned.pem
* creating test/fixtures/ssl/client.pem

The certificates and keys can be found in test/fixtures/ssl.

WARNING: only use the generated certificates for testing in a closed network
environment, such as running a development server on `localhost`.
For production, staging, or testing servers on the public internet, obtain a
proper certificate, for example from [Let's Encrypt](https://letsencrypt.org).

..................
21:15:34.231 [warning] Description: 'Authenticity is not established by certificate path validation'
     Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

21:15:34.265 [error] :closed

  1) test http2 server push without automatic mime type (Plug.Cowboy.ConnTest)
     test/plug/cowboy/conn_test.exs:607
     ** (EXIT from #PID<0.696.0>) bad return value: {:error, :closed}

21:15:34.262 [error] Ranch listener Plug.Cowboy.ConnTest.HTTPS had connection process started with :cowboy_tls:start_link/4 at #PID<0.704.0> exit with reason: {:undef, [{:ssl, :ssl_accept, [{:sslsocket, {:gen_tcp, #Port<0.18>, :tls_connection, [option_tracker: #PID<0.577.0>, session_tickets_tracker: :disabled, session_id_tracker: #PID<0.578.0>]}, [#PID<0.702.0>, #PID<0.701.0>]}, [], 5000], []}, {:ranch_ssl, :handshake, 3, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch_ssl.erl', line: 142]}, {:ranch, :handshake, 2, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch.erl', line: 243]}, {:cowboy_tls, :connection_process, 4, [file: '/tmp/plug_cowboy/deps/cowboy/src/cowboy_tls.erl', line: 43]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

......
21:15:35.289 [error] Ranch listener Plug.Cowboy.ConnTest.HTTPS had connection process started with :cowboy_tls:start_link/4 at #PID<0.730.0> exit with reason: {:undef, [{:ssl, :ssl_accept, [{:sslsocket, {:gen_tcp, #Port<0.22>, :tls_connection, [option_tracker: #PID<0.577.0>, session_tickets_tracker: :disabled, session_id_tracker: #PID<0.578.0>]}, [#PID<0.729.0>, #PID<0.728.0>]}, [], 5000], []}, {:ranch_ssl, :handshake, 3, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch_ssl.erl', line: 142]}, {:ranch, :handshake, 2, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch.erl', line: 243]}, {:cowboy_tls, :connection_process, 4, [file: '/tmp/plug_cowboy/deps/cowboy/src/cowboy_tls.erl', line: 43]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

  2) test exposes peer data (Plug.Cowboy.ConnTest)
     test/plug/cowboy/conn_test.exs:624
     match (=) failed
     code:  assert {:ok, 200, _headers, client} = :hackney.get("https://127.0.0.1:8004/peer_data", [], "", opts)
     left:  {:ok, 200, _headers, client}
     right: {:error, :closed}
     stacktrace:
       test/plug/cowboy/conn_test.exs:634: (test)

...
21:15:35.332 [warning] Description: 'Authenticity is not established by certificate path validation'
     Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

21:15:35.336 [error] Ranch listener Plug.Cowboy.ConnTest.HTTPS had connection process started with :cowboy_tls:start_link/4 at #PID<0.746.0> exit with reason: {:undef, [{:ssl, :ssl_accept, [{:sslsocket, {:gen_tcp, #Port<0.26>, :tls_connection, [option_tracker: #PID<0.577.0>, session_tickets_tracker: :disabled, session_id_tracker: #PID<0.578.0>]}, [#PID<0.745.0>, #PID<0.743.0>]}, [], 5000], []}, {:ranch_ssl, :handshake, 3, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch_ssl.erl', line: 142]}, {:ranch, :handshake, 2, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch.erl', line: 243]}, {:cowboy_tls, :connection_process, 4, [file: '/tmp/plug_cowboy/deps/cowboy/src/cowboy_tls.erl', line: 43]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

  3) test https (Plug.Cowboy.ConnTest)
     test/plug/cowboy/conn_test.exs:543
     match (=) failed
     code:  assert {:ok, 200, _headers, client} = :hackney.get("https://127.0.0.1:8004/https", [], "", opts)
     left:  {:ok, 200, _headers, client}
     right: {:error, :closed}
     stacktrace:
       test/plug/cowboy/conn_test.exs:553: (test)

......
21:15:35.477 [error] Ranch protocol #PID<0.767.0> of listener Plug.Cowboy.ConnTest.HTTP (connection #PID<0.732.0>, stream id 14) terminated
an exception was raised:
    ** (UndefinedFunctionError) function :erlang.get_stacktrace/0 is undefined or private
        :erlang.get_stacktrace()
        (cowboy 2.7.0) /tmp/plug_cowboy/deps/cowboy/src/cowboy_stream_h.erl:314: :cowboy_stream_h.request_process/3
        (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
..
21:15:35.480 [warning] Description: 'Authenticity is not established by certificate path validation'
     Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

21:15:35.480 [error] :closed

21:15:35.480 [error] Ranch listener Plug.Cowboy.ConnTest.HTTPS had connection process started with :cowboy_tls:start_link/4 at #PID<0.778.0> exit with reason: {:undef, [{:ssl, :ssl_accept, [{:sslsocket, {:gen_tcp, #Port<0.28>, :tls_connection, [option_tracker: #PID<0.577.0>, session_tickets_tracker: :disabled, session_id_tracker: #PID<0.578.0>]}, [#PID<0.777.0>, #PID<0.775.0>]}, [], 5000], []}, {:ranch_ssl, :handshake, 3, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch_ssl.erl', line: 142]}, {:ranch, :handshake, 2, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch.erl', line: 243]}, {:cowboy_tls, :connection_process, 4, [file: '/tmp/plug_cowboy/deps/cowboy/src/cowboy_tls.erl', line: 43]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

21:15:35.481 [warning] Description: 'Authenticity is not established by certificate path validation'
     Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

21:15:35.483 [error] :closed

21:15:35.483 [error] Ranch listener Plug.Cowboy.ConnTest.HTTPS had connection process started with :cowboy_tls:start_link/4 at #PID<0.787.0> exit with reason: {:undef, [{:ssl, :ssl_accept, [{:sslsocket, {:gen_tcp, #Port<0.30>, :tls_connection, [option_tracker: #PID<0.577.0>, session_tickets_tracker: :disabled, session_id_tracker: #PID<0.578.0>]}, [#PID<0.786.0>, #PID<0.784.0>]}, [], 5000], []}, {:ranch_ssl, :handshake, 3, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch_ssl.erl', line: 142]}, {:ranch, :handshake, 2, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch.erl', line: 243]}, {:cowboy_tls, :connection_process, 4, [file: '/tmp/plug_cowboy/deps/cowboy/src/cowboy_tls.erl', line: 43]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

21:15:35.483 [warning] Description: 'Authenticity is not established by certificate path validation'
     Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

21:15:35.484 [error] :closed

21:15:35.484 [error] Ranch listener Plug.Cowboy.ConnTest.HTTPS had connection process started with :cowboy_tls:start_link/4 at #PID<0.796.0> exit with reason: {:undef, [{:ssl, :ssl_accept, [{:sslsocket, {:gen_tcp, #Port<0.32>, :tls_connection, [option_tracker: #PID<0.577.0>, session_tickets_tracker: :disabled, session_id_tracker: #PID<0.578.0>]}, [#PID<0.795.0>, #PID<0.794.0>]}, [], 5000], []}, {:ranch_ssl, :handshake, 3, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch_ssl.erl', line: 142]}, {:ranch, :handshake, 2, [file: '/tmp/plug_cowboy/deps/ranch/src/ranch.erl', line: 243]}, {:cowboy_tls, :connection_process, 4, [file: '/tmp/plug_cowboy/deps/cowboy/src/cowboy_tls.erl', line: 43]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

  4) test http2 response (Plug.Cowboy.ConnTest)
     test/plug/cowboy/conn_test.exs:585
     ** (MatchError) no match of right hand side value: {:error, {:bad_return_value, {:error, :closed}}}
     code: {:ok, pid} = Kadabra.open('localhost', :https, @http2_opts)
     stacktrace:
       test/plug/cowboy/conn_test.exs:586: (test)

  5) test http2 server push (Plug.Cowboy.ConnTest)
     test/plug/cowboy/conn_test.exs:599
     ** (MatchError) no match of right hand side value: {:error, {:bad_return_value, {:error, :closed}}}
     code: {:ok, pid} = Kadabra.open('localhost', :https, @http2_opts)
     stacktrace:
       test/plug/cowboy/conn_test.exs:600: (test)

  6) test http2 early hints (Plug.Cowboy.ConnTest)
     test/plug/cowboy/conn_test.exs:592
     ** (MatchError) no match of right hand side value: {:error, {:bad_return_value, {:error, :closed}}}
     code: {:ok, pid} = Kadabra.open('localhost', :https, @http2_opts)
     stacktrace:
       test/plug/cowboy/conn_test.exs:593: (test)

.

  7) test metadata in ranch/cowboy 500 logs (Plug.Cowboy.TranslatorTest)
     test/plug/cowboy/translator_test.exs:106
     Assertion with =~ failed
     code:  assert metadata =~ "conn: %Plug.Conn{"
     left:  "[crash_reason: :undef, domain: [:cowboy]]"
     right: "conn: %Plug.Conn{"
     stacktrace:
       test/plug/cowboy/translator_test.exs:115: (test)

.

  8) test ranch/cowboy 500 logs (Plug.Cowboy.TranslatorTest)
     test/plug/cowboy/translator_test.exs:28
     Assertion with =~ failed
     code:  assert output =~ ~r"#PID<0\.\d+\.0> running Plug\.Cowboy\.TranslatorTest \(.*\) terminated"
     left:  "\n21:15:37.512 [error] Ranch protocol #PID<0.1130.0> of listener Plug.Cowboy.TranslatorTest.HTTP (connection #PID<0.1129.0>, stream id 1) terminated\nan exception was raised:\n    ** (UndefinedFunctionError) function :erlang.get_stacktrace/0 is undefined or private\n        :erlang.get_stacktrace()\n        (cowboy 2.7.0) /tmp/plug_cowboy/deps/cowboy/src/cowboy_stream_h.erl:314: :cowboy_stream_h.request_process/3\n        (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3\n"
     right: ~r/#PID<0\.\d+\.0> running Plug\.Cowboy\.TranslatorTest \(.*\) terminated/
     stacktrace:
       test/plug/cowboy/translator_test.exs:37: (test)

..

  9) test ranch/cowboy logs configured statuses (Plug.Cowboy.TranslatorTest)
     test/plug/cowboy/translator_test.exs:59
     Assertion with =~ failed
     code:  assert output =~ ~r"#PID<0\.\d+\.0> running Plug\.Cowboy\.TranslatorTest \(.*\) terminated"
     left:  "\n21:15:40.537 [error] Ranch protocol #PID<0.1458.0> of listener Plug.Cowboy.TranslatorTest.HTTP (connection #PID<0.1457.0>, stream id 1) terminated\nan exception was raised:\n    ** (UndefinedFunctionError) function :erlang.get_stacktrace/0 is undefined or private\n        :erlang.get_stacktrace()\n        (cowboy 2.7.0) /tmp/plug_cowboy/deps/cowboy/src/cowboy_stream_h.erl:314: :cowboy_stream_h.request_process/3\n        (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3\n"
     right: ~r/#PID<0\.\d+\.0> running Plug\.Cowboy\.TranslatorTest \(.*\) terminated/
     stacktrace:
       test/plug/cowboy/translator_test.exs:71: (test)

Finished in 7.7 seconds (1.6s async, 6.0s sync)
48 tests, 9 failures

Randomized with seed 788721
josevalim commented 2 years ago

I believe you need to update ranch, Cowboy and cowlib dependencies.

fastjames commented 2 years ago

I opened a PR to add the newer elixir to the test matrix (and to update those deps), hopefully it's useful to keep things fresh.