Skip to content

Commit

Permalink
all tests should pass with and without websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
robnagler committed Aug 8, 2023
1 parent 29b21a1 commit ec444cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 2 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ test_js() {
test_main() {
test_js
test_no_h5py
pykern ci run
SIREPO_FEATURE_CONFIG_UI_WEBSOCKET=0 pykern ci run
SIREPO_FEATURE_CONFIG_UI_WEBSOCKET=1 pykern test
}

test_no_h5py() {
Expand Down
15 changes: 6 additions & 9 deletions tests/job_concurrency1_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def test_myapp_cancel(fc):
"""https://github.com/radiasoft/sirepo/issues/2346"""
from pykern import pkunit
import time
import threading
from pykern.pkdebug import pkdlog

d1 = fc.sr_sim_data()
Expand Down Expand Up @@ -93,19 +92,18 @@ def test_elegant_concurrent_sim_frame(fc):
from pykern.pkcollections import PKDict
from pykern.pkdebug import pkdlog, pkdp
import sirepo.sim_data
import threading
import time

def _get_frames():
def _get_frames(fc):
for i in range(3):
f = fc.sr_get_json(
"simulationFrame",
PKDict(frame_id=s.frame_id(d, r1, "elementAnimation19-5", 0)),
)
pkunit.pkeq("completed", f.state)

def _t2(get_frames):
get_frames()
def _t2(fc):
_get_frames(fc)

d = fc.sr_sim_data(sim_name="Backtracking", sim_type="elegant")
s = sirepo.sim_data.get_class(fc.sr_sim_type)
Expand All @@ -131,10 +129,9 @@ def _t2(get_frames):
r1 = fc.sr_post("runStatus", r1.nextRequest)
else:
pkunit.pkfail("runStatus: failed to complete: {}", r1)
t2 = threading.Thread(target=_t2, args=(_get_frames,))
t2.start()
_get_frames()
t2.join()
fc.sr_thread_start("t2", _t2)
_get_frames(fc)
fc.sr_thread_join()
finally:
if r1.get("nextRequest"):
fc.sr_post("runCancel", r1.nextRequest)

0 comments on commit ec444cc

Please sign in to comment.