Wrap app info into tuples

This commit is contained in:
José Valim 2024-03-28 08:40:29 +01:00
parent 0ff1b8d19c
commit 65632603a3
2 changed files with 16 additions and 14 deletions

View file

@ -1641,7 +1641,7 @@ defmodule Livebook.Session do
end end
def handle_info({:runtime_app_info_request, reply_to}, state) do def handle_info({:runtime_app_info_request, reply_to}, state) do
send(reply_to, {:runtime_app_info_reply, app_info_for_runtime(state)}) send(reply_to, {:runtime_app_info_reply, {:ok, app_info_for_runtime(state)}})
{:noreply, state} {:noreply, state}
end end

View file

@ -1447,7 +1447,7 @@ defmodule Livebook.SessionTest do
send(session.pid, {:runtime_app_info_request, self()}) send(session.pid, {:runtime_app_info_request, self()})
assert_receive {:runtime_app_info_reply, app_info} assert_receive {:runtime_app_info_reply, app_info}
assert app_info == %{type: :multi_session} assert app_info == {:ok, %{type: :multi_session}}
# Single-session # Single-session
@ -1459,7 +1459,7 @@ defmodule Livebook.SessionTest do
send(session.pid, {:runtime_app_info_request, self()}) send(session.pid, {:runtime_app_info_request, self()})
assert_receive {:runtime_app_info_reply, app_info} assert_receive {:runtime_app_info_reply, app_info}
assert app_info == %{type: :single_session} assert app_info == {:ok, %{type: :single_session}}
App.close(app_pid) App.close(app_pid)
end end
@ -1485,15 +1485,17 @@ defmodule Livebook.SessionTest do
send(session.pid, {:runtime_app_info_request, self()}) send(session.pid, {:runtime_app_info_request, self()})
assert_receive {:runtime_app_info_reply, app_info} assert_receive {:runtime_app_info_reply, app_info}
assert app_info == %{ assert app_info ==
type: :multi_session, {:ok,
started_by: %{ %{
source: :session, type: :multi_session,
id: "1234", started_by: %{
name: "Jake Peralta", source: :session,
email: "jperalta@example.com" id: "1234",
} name: "Jake Peralta",
} email: "jperalta@example.com"
}
}}
# Single-session # Single-session
@ -1505,7 +1507,7 @@ defmodule Livebook.SessionTest do
send(session.pid, {:runtime_app_info_request, self()}) send(session.pid, {:runtime_app_info_request, self()})
assert_receive {:runtime_app_info_reply, app_info} assert_receive {:runtime_app_info_reply, app_info}
assert app_info == %{type: :single_session} assert app_info == {:ok, %{type: :single_session}}
App.close(app_pid) App.close(app_pid)
end end
@ -1517,7 +1519,7 @@ defmodule Livebook.SessionTest do
send(session.pid, {:runtime_app_info_request, self()}) send(session.pid, {:runtime_app_info_request, self()})
assert_receive {:runtime_app_info_reply, app_info} assert_receive {:runtime_app_info_reply, app_info}
assert app_info == %{type: :none} assert app_info == {:ok, %{type: :none}}
end end
describe "to_attachment_file_entry/2" do describe "to_attachment_file_entry/2" do