Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

more thoroughly test session + server to figure out the problem with … #4557

Open
wants to merge 7 commits into
base: master
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 WGLMakie/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ShaderAbstractions = "65257c39-d410-5151-9873-9b3e5be5013e"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
Bonito = "3.2.4, 4"
Bonito = "4"
Colors = "0.11, 0.12, 0.13"
FileIO = "1.1"
FreeTypeAbstraction = "0.10"
Expand Down
30 changes: 26 additions & 4 deletions WGLMakie/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,42 @@ end
display(edisplay, app)
GC.gc(true);
# Somehow this may take a while to get emptied completely
Bonito.wait_for(() -> (GC.gc(true);isempty(run(edisplay.window, "Object.keys(WGL.plot_cache)")));timeout=20)
value = @time Bonito.wait_for(() -> (GC.gc(true); isempty(run(edisplay.window, "Object.keys(WGL.plot_cache)"))); timeout=200)
@show run(edisplay.window, "Object.keys(WGL.plot_cache)")
@test value == :success

s_keys = "Object.keys(Bonito.Sessions.SESSIONS)"
value = @time Bonito.wait_for(() -> (GC.gc(true); length(run(edisplay.window, s_keys)) == 2); timeout=200)
@show run(edisplay.window, s_keys)
@show app.session[].id
@show app.session[].parent
@test value == :success

wgl_plots = run(edisplay.window, "Object.keys(WGL.scene_cache)")
@test isempty(wgl_plots)

session = edisplay.browserdisplay.handler.session
session_size = Base.summarysize(session) / 10^6
texture_atlas_size = Base.summarysize(WGLMakie.TEXTURE_ATLAS) / 10^6

@test length(WGLMakie.TEXTURE_ATLAS.listeners) == 1 # Only one from permanent Retain
@test length(session.session_objects) == 1 # Also texture atlas because of Retain
@testset "Session fields empty" for field in [:on_document_load, :stylesheets, :imports, :message_queue, :deregister_callbacks, :inbox]
@test isempty(getfield(session, field))
end
server = session.connection.server
@test length(server.websocket_routes.table) == 1
@test server.websocket_routes.table[1][2] == session.connection
@test length(server.routes.table) == 2
@test server.routes.table[1][1] == "/browser-display"
@test server.routes.table[2][2] isa HTTPAssetServer
@show typeof.(last.(WGLMakie.TEXTURE_ATLAS.listeners))
@show length(WGLMakie.TEXTURE_ATLAS.listeners)
@show session_size texture_atlas_size
@test session_size / 10^6 < 6

@test session_size < 6
@test texture_atlas_size < 6
s_keys = "Object.keys(Bonito.Sessions.SESSIONS)"
Bonito.wait_for(() -> (GC.gc(true); 2 == length(run(edisplay.window, s_keys))); timeout=30)

js_sessions = run(edisplay.window, "Bonito.Sessions.SESSIONS")
js_objects = run(edisplay.window, "Bonito.Sessions.GLOBAL_OBJECT_CACHE")
# @test Set([app.session[].id, app.session[].parent.id]) == keys(js_sessions)
Expand Down
Loading