From 2a7ca619c1188418ce06362b327c2b4fc89db32c Mon Sep 17 00:00:00 2001 From: CamDavidsonPilon Date: Mon, 16 Sep 2024 22:02:06 -0400 Subject: [PATCH] fix tests --- CHANGELOG.md | 1 + pioreactor/tests/test_execute_experiment_profile.py | 10 ++++++---- pioreactor/tests/test_od_reading.py | 11 ++++++----- update_scripts/upcoming/update.sh | 11 ++++++----- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e62a4f9c..36614f9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ #### Bug fixes - fixed an issue where a calibrated OD reading would be mapped to max OD signal if it was too low. - fixed an issue where the Pioreactor UI would lock up if trying to create a new experiment with an existing name. + - fixed Hours Elapsed not updating in Overview #### Breaking changes - **Lots and lots of API changes**. You'll want to review them on our docs: https://docs.pioreactor.com/developer-guide/web-ui-api diff --git a/pioreactor/tests/test_execute_experiment_profile.py b/pioreactor/tests/test_execute_experiment_profile.py index a55a0ca2..6fedf5dd 100644 --- a/pioreactor/tests/test_execute_experiment_profile.py +++ b/pioreactor/tests/test_execute_experiment_profile.py @@ -678,8 +678,9 @@ def collect_actions(msg): allow_retained=False, ) - with start_stirring(target_rpm=500, unit="unit1", experiment=experiment, use_rpm=True): - execute_experiment_profile("profile.yaml", experiment) + with capture_requests(): + with start_stirring(target_rpm=500, unit="unit1", experiment=experiment, use_rpm=True): + execute_experiment_profile("profile.yaml", experiment) assert actions == [500, 1000, 200] @@ -730,8 +731,9 @@ def collect_actions(msg): allow_retained=False, ) - with start_stirring(target_rpm=500, unit="unit1", experiment=experiment, use_rpm=True): - execute_experiment_profile("profile.yaml", experiment) + with capture_requests(): + with start_stirring(target_rpm=500, unit="unit1", experiment=experiment, use_rpm=True): + execute_experiment_profile("profile.yaml", experiment) assert actions == [500, 1000, 200, 400] diff --git a/pioreactor/tests/test_od_reading.py b/pioreactor/tests/test_od_reading.py index f95bae43..fe0032ce 100644 --- a/pioreactor/tests/test_od_reading.py +++ b/pioreactor/tests/test_od_reading.py @@ -863,6 +863,7 @@ def test_calibration_errors_when_pd_channel_differs() -> None: def test_calibration_with_irl_data1() -> None: + MAX_OD = 1.131 with local_persistant_storage("current_od_calibration") as c: c["90"] = encode( structs.OD90Calibration( @@ -876,7 +877,7 @@ def test_calibration_with_irl_data1() -> None: 0.0024870149666305712, ], name="quad_test", - maximum_od600=1.131, + maximum_od600=MAX_OD, minimum_od600=0.0, ir_led_intensity=70.0, angle="90", @@ -902,9 +903,9 @@ def test_calibration_with_irl_data1() -> None: cc.hydate_models_from_disk({"2": "90"}) assert cc({"2": 0.001})["2"] == 0 assert cc({"2": 0.002})["2"] == 0 - assert cc({"2": 0.004})["2"] == 0.0032975807375385234 - assert cc({"2": 0.020})["2"] == 0.03639585015289039 - assert cc({"2": 1.0})["2"] == 1.131 + assert abs(cc({"2": 0.004})["2"] - 0.0032975807375385234) < 1e-5 + assert abs(cc({"2": 0.020})["2"] - 0.03639585015289039) < 1e-5 + assert cc({"2": 1.0})["2"] == MAX_OD with local_persistant_storage("current_od_calibration") as c: del c["90"] @@ -1054,7 +1055,7 @@ def test_auto_ir_led_intensit_REF_and_90() -> None: experiment = "test_auto_ir_led_intensity" with start_od_reading("REF", "90", interval=None, fake_data=True, experiment=experiment) as od: - assert abs(od.ir_led_intensity - 67.19794921875) < 0.001 + assert abs(od.ir_led_intensity - 67.19794921875) < 0.01 config["od_reading.config"]["ir_led_intensity"] = existing_intensity diff --git a/update_scripts/upcoming/update.sh b/update_scripts/upcoming/update.sh index 9b67cef8..9094e954 100644 --- a/update_scripts/upcoming/update.sh +++ b/update_scripts/upcoming/update.sh @@ -9,7 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" UI_FOLDER=/var/www/pioreactorui SYSTEMD_DIR=/lib/systemd/system/ -UI_TAG="TODO" # TODO +UI_TAG="24.9.16" # TODO PIO_DIR="/home/pioreactor/.pioreactor" HOSTNAME=$(hostname) @@ -58,11 +58,12 @@ if [ "$HOSTNAME" != "$LEADER_HOSTNAME" ]; then cp -u "$SCRIPT_DIR"/50-pioreactorui.conf /etc/lighttpd/conf-available/ cp -u "$SCRIPT_DIR"/52-api-only.conf /etc/lighttpd/conf-available/ - /usr/sbin/lighttpd-enable-mod fastcgi - /usr/sbin/lighttpd-enable-mod rewrite - /usr/sbin/lighttpd-enable-mod pioreactorui + # lighttpd-enable-mod returns !0 if already enabled, breaking a potential reinstall. + /usr/sbin/lighttpd-enable-mod fastcgi || true + /usr/sbin/lighttpd-enable-mod rewrite || true + /usr/sbin/lighttpd-enable-mod pioreactorui || true # workers only have an api, not served static files. - /usr/sbin/lighttpd-enable-mod api-only + /usr/sbin/lighttpd-enable-mod api-only || true cp -u "$SCRIPT_DIR"/create_diskcache.sh /usr/local/bin/