Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Test billable events #1317

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/realtime_web/channels/auth/channels_authorization.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule RealtimeWeb.ChannelsAuthorization do

{:error, [message: validation_timer, claim: "exp", claim_val: claim_val]}
when is_integer(validation_timer) ->
msg = "Token hasexpired #{validation_timer - claim_val} seconds ago"
msg = "Token has expired #{validation_timer - claim_val} seconds ago"
{:error, :expired_token, msg}

{:error, reason} ->
Expand Down
2 changes: 1 addition & 1 deletion lib/realtime_web/channels/realtime_channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ defmodule RealtimeWeb.RealtimeChannel do

@impl true
def terminate(reason, _state) do
Logger.debug("Channel terminated with reason: " <> inspect(reason))
Logger.debug("Channel terminated with reason: #{reason}")
:telemetry.execute([:prom_ex, :plugin, :realtime, :disconnected], %{})
:ok
end
Expand Down
12 changes: 6 additions & 6 deletions test/integration/rt_channel_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ defmodule Realtime.Integration.RtChannelTest do
test "invalid JWT with expired token" do
assert capture_log(fn ->
get_connection("authenticated", %{:exp => System.system_time(:second) - 1000})
end) =~ "InvalidJWTToken: Token hasexpired 1000 seconds ago"
end) =~ "InvalidJWTToken: Token has expired 1000 seconds ago"
end

test "token required the role key" do
Expand Down Expand Up @@ -673,13 +673,13 @@ defmodule Realtime.Integration.RtChannelTest do
event: "system",
payload: %{
"extension" => "system",
"message" => "Token hasexpired 1000 seconds ago",
"message" => "Token has expired 1000 seconds ago",
"status" => "error"
}
}
end)

assert log =~ "ChannelShutdown: Token hasexpired 1000 seconds ago"
assert log =~ "ChannelShutdown: Token has expired 1000 seconds ago"
end

test "ChannelShutdown include sub if available in jwt claims",
Expand Down Expand Up @@ -773,7 +773,7 @@ defmodule Realtime.Integration.RtChannelTest do

assert_receive %Message{event: "phx_close"}

assert msg =~ "Token hasexpired"
assert msg =~ "Token has expired"
end

test "token expires in between joins", %{topic: topic} do
Expand All @@ -798,7 +798,7 @@ defmodule Realtime.Integration.RtChannelTest do
event: "phx_reply",
payload: %{
"status" => "error",
"response" => %{"reason" => "Token hasexpired 0 seconds ago"}
"response" => %{"reason" => "Token has expired 0 seconds ago"}
},
topic: ^realtime_topic
},
Expand Down Expand Up @@ -1264,7 +1264,7 @@ defmodule Realtime.Integration.RtChannelTest do
get_connection("authenticated", %{:exp => System.system_time(:second) - 1000})
end)

assert log =~ "InvalidJWTToken: Token hasexpired"
assert log =~ "InvalidJWTToken: Token has expired"
end
end

Expand Down
Loading
Loading