elixir-tesla / tesla

The flexible HTTP client library for Elixir, with support for middleware and multiple adapters.
MIT License
2.01k stars 348 forks source link

Test failures and compiler warnings in Elixir 1.16 (httparrot) #684

Closed nathany-copia closed 5 months ago

nathany-copia commented 5 months ago

There are quite a few test failures and warnings in Elixir 1.16.

The test failures are related to httparrot not yet supporting newer versions of Elixir. https://github.com/edgurgel/httparrot/issues/38

It looks like the old version of cowboy is also getting brought in via httparrot.

Example CI run: https://github.com/elixir-tesla/tesla/actions/runs/9587197853/job/26436887009

nathany-copia commented 5 months ago

This is the complete log when running locally with Elixir 1.16.3

warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.....warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.2024-06-19 13:27:03.629 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:03.637 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

  1) test SSL GET request (Tesla.Adapter.HackneyTest)
     test/tesla/adapter/hackney_test.exs:9
     match (=) failed
     code:  assert {:ok, %Env{} = response} =
              call(request,
                ssl_options: [
                  verify: :verify_peer,
                  cacertfile: Path.join([to_string(:code.priv_dir(:httparrot)), "/ssl/server-ca.crt"])
                ]
              )
     left:  {:ok, %Tesla.Env{} = response}
     right: {:error, {:tls_alert, {:handshake_failure, ~c"TLS client: In state hello received SERVER ALERT: Fatal - Handshake Failure\n"}}}
     stacktrace:
       test/tesla/adapter/hackney_test.exs:9: (test)

...warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..........................warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

...warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

...warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

...warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..........warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.....warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.2024-06-19 13:27:03.798 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:03.801 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

  2) test SSL GET request (Tesla.Adapter.MintTest)
     test/tesla/adapter/mint_test.exs:9
     match (=) failed
     code:  assert {:ok, %Env{} = response} =
              call(request,
                transport_opts: [
                  cacertfile: Path.join([to_string(:code.priv_dir(:httparrot)), "/ssl/server-ca.crt"])
                ]
              )
     left:  {:ok, %Tesla.Env{} = response}
     right: {
              :error,
              %Mint.TransportError{reason: {:tls_alert, {:handshake_failure, ~c"TLS client: In state hello received SERVER ALERT: Fatal - Handshake Failure\n"}}}
            }
     stacktrace:
       test/tesla/adapter/mint_test.exs:9: (test)

...2024-06-19 13:27:03.816 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:03.821 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

  3) test certificates_verification (Tesla.Adapter.MintTest)
     test/tesla/adapter/mint_test.exs:61
     match (=) failed
     code:  assert {:ok, %Env{} = response} =
              call(request,
                certificates_verification: true,
                transport_opts: [verify_fun: {fn _cert, _reason, state -> {:valid, state} end, nil}]
              )
     left:  {:ok, %Tesla.Env{} = response}
     right: {
              :error,
              %Mint.TransportError{reason: {:tls_alert, {:handshake_failure, ~c"TLS client: In state hello received SERVER ALERT: Fatal - Handshake Failure\n"}}}
            }
     stacktrace:
       test/tesla/adapter/mint_test.exs:67: (test)

.warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

...warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.....2024-06-19 13:27:04.863 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:04.869 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

2024-06-19 13:27:04.870 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:04.876 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

  4) test certificates_verification option (Tesla.Adapter.GunTest)
     test/tesla/adapter/gun_test.exs:105
     match (=) failed
     code:  assert {:ok, %Env{} = _response} =
              call(request,
                certificates_verification: true,
                transport_opts: [cacertfile: "#{:code.priv_dir(:httparrot)}/ssl/server-ca.crt"]
              )
     left:  {:ok, %Tesla.Env{} = _response}
     right: {:error, :timeout}
     stacktrace:
       test/tesla/adapter/gun_test.exs:111: (test)

....warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.....warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.2024-06-19 13:27:14.894 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:14.898 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

2024-06-19 13:27:14.900 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:14.910 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

  5) test SSL GET request (Tesla.Adapter.GunTest)
     test/tesla/adapter/gun_test.exs:9
     match (=) failed
     code:  assert {:ok, %Env{} = response} =
              call(request,
                certificates_verification: true,
                transport_opts: [
                  cacertfile: Path.join([to_string(:code.priv_dir(:httparrot)), "/ssl/server-ca.crt"])
                ]
              )
     left:  {:ok, %Tesla.Env{} = response}
     right: {:error, :timeout}
     stacktrace:
       test/tesla/adapter/gun_test.exs:9: (test)

.....

  6) test on TLS errors get timeout error from await_up method (Tesla.Adapter.GunTest)
     test/tesla/adapter/gun_test.exs:201
     Assertion with =~ failed
     code:  assert log =~ "Unknown CA"
     left:  "\e[22m2024-06-19 13:27:19.909 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure\n - :unable_to_supply_acceptable_cert\n\e[0m\e[22m2024-06-19 13:27:19.913 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure\n\n\e[0m\e[22m2024-06-19 13:27:19.915 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure\n - :unable_to_supply_acceptable_cert\n\e[0m\e[22m2024-06-19 13:27:19.920 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure\n\n\e[0m"
     right: "Unknown CA"
     stacktrace:
       test/tesla/adapter/gun_test.exs:222: (test)

warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

...........................................................warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.....warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.2024-06-19 13:27:24.947 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:24.949 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

  7) test SSL GET request (Tesla.Adapter.HttpcTest)
     test/tesla/adapter/httpc_test.exs:9
     match (=) failed
     code:  assert {:ok, %Env{} = response} =
              call(request,
                ssl: [
                  verify: :verify_peer,
                  cacertfile: Path.join([to_string(:code.priv_dir(:httparrot)), "/ssl/server-ca.crt"])
                ]
              )
     left:  {:ok, %Tesla.Env{} = response}
     right: {:error, :econnrefused}
     stacktrace:
       test/tesla/adapter/httpc_test.exs:9: (test)

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.........................................................warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

.2024-06-19 13:27:27.894 [notice] TLS :server: In state :start at tls_server_connection_1_3.erl:689 generated SERVER ALERT: Fatal - Handshake Failure
 - :unable_to_supply_acceptable_cert
2024-06-19 13:27:27.900 [notice] TLS :client: In state :hello received SERVER ALERT: Fatal - Handshake Failure

  8) test SSL GET request (Tesla.Adapter.FinchTest)
     test/tesla/adapter/finch_test.exs:11
     match (=) failed
     code:  assert {:ok, %Env{} = response} = call(request, [])
     left:  {:ok, %Tesla.Env{} = response}
     right: {:error, {:tls_alert, {:handshake_failure, ~c"TLS client: In state hello received SERVER ALERT: Fatal - Handshake Failure\n"}}}
     stacktrace:
       test/tesla/adapter/finch_test.exs:11: (test)

...warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

....warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

..warning: negative steps are not supported in String.slice/2, pass 1..-1//1 instead
  (elixir 1.16.3) lib/string.ex:2369: String.slice/2
  (httparrot 1.3.0) lib/httparrot/p_handler.ex:16: HTTParrot.PHandler.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:1575: :cowboy_rest.call/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:329: :cowboy_rest.allowed_methods/2
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_rest.erl:284: :cowboy_rest.upgrade/4
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
  (cowboy 2.8.0) /elixir-tesla/tesla/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
  (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

....
Finished in 35.7 seconds (1.1s async, 34.5s sync)
8 doctests, 392 tests, 8 failures
nathany-copia commented 5 months ago

@yordis If you were to replace httparrot with something else, what would that be? Is bypass the same kind of thing?

Still hoping we can just get httparrot working

yordis commented 5 months ago

Ideally, helping the httparrot package would be amazing.

Does bypass support HTTPs? I know Dan Schultzer created https://hexdocs.pm/test_server/README.html to improve the shortcomings of bypass.

I am not opposed to test_server or something similar. But we would need to replicate the httparrot

nathany-copia commented 5 months ago

Okay.

https://github.com/edgurgel/httparrot/pull/39 <- maybe that will do the trick

nathany-copia commented 5 months ago

The https://github.com/edgurgel/httparrot/pull/39 pull request fixes all the compiler warnings on Elixir 1.16 and all the tests pass for httparrot.

However, if I use that branch from Tesla, it's the same 8 test failures as above ☝🏻 .

{:httparrot, "~> 1.3", only: :test, path: "../../edgurgel/httparrot"},
yordis commented 5 months ago

As I said before, somewhere, I believe the issue is related to the built-in SSL files, or something-something SSL (check the failure, it is a SSL handshake error). Ideally, it would use the new built-in function from OTP 25+ to get the cert files if possible