Files
Classroom_Desktop/tests/test-classroom-config.sh
T
ekklesiaandClaude Opus 5 d2d30d6b0c feat: take the last of sway out of the classroom
The DVD player was the only thing still speaking a compositor the room
no longer runs. It asked sway's tree whether VLC's window had really
gone fullscreen, because VLC reports playing while its window is still
the black startup one the loading cover exists to hide.

VLC's own status was measured as a replacement and is not one: it
reports fullscreen true in the same 250ms poll as playing, because the
flag is the option it was started with and not a report about its
window. So the cover is held for a floor and capped by the deadline that
was already there, and the compositor is not asked anything.

Focus-or-launch went the same way. The session already takes an
exclusive lock, so a second one cannot start, and bringing an existing
one to the front is the panel's job.

classroom-window, classroom_sway and classroom_chrome are gone with it —
the last of them was reachable from nothing at all.

DVD also moves out of the status row, where it sat beside the clock as
though a disc were a machine reading. It is an application: it is in the
row with Wonder Ink and the browser, and classroom-provision removes it
from the layout on a machine with no optical drive, which retires
DVD_ENABLED. A computer that moves between rooms takes its drive with
it; nobody remembers to edit a file when it does.

The panel is rebuilt from the package at every login now. Plasma keeps
whatever panel it first built, so an update could change the bar in the
package and never change it in a room — measured, with an icon that
outlived the file it came from. Editing the live panel configuration was
tried instead and destroyed the panel, because the shell owns that file.
Removing it before the shell starts is safe and makes the desktop
stateless.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-10 13:00:50 -05:00

81 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
set -uo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PYTHONPATH="$ROOT/lib" python3 - <<'PY'
import tempfile
from pathlib import Path
from classroom_config import ensure_device_config, read_device_config
passed = failed = 0
def check(label, condition, detail=""):
global passed, failed
if condition:
print(f" ok {label}")
passed += 1
else:
print(f" FAIL {label}")
if detail:
print(f" {detail}")
failed += 1
print("1. the room no longer keeps a list of dock buttons")
check("dock_items is gone with the dock it described",
not hasattr(__import__("classroom_config"), "dock_items"))
check("and DVD_ENABLED with it, because the machine can be asked",
"DVD_ENABLED" not in __import__("classroom_config").DEVICE_CONFIG_TEMPLATE)
print("2. fresh device configuration")
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / "etc" / "device.conf"
ensure_device_config(path)
config = read_device_config(path)
check("fresh config is created", path.is_file())
check("MQTT defaults off", config.get("MQTT_ENABLED") == "false")
check("stable remains the fresh-install default", config.get("CHANNEL") == "stable")
print()
print("3. upgrade from 0.1.36")
old = """# endpoint configuration from 0.1.36
UPDATE_URL=https://updates.example.test
CHANNEL=canary
DVD_ENABLED=true
UI_SCALE=1.25
MQTT_ENABLED=true
MQTT_HOST=broker.example.test
MQTT_PORT=1884
MQTT_USERNAME=room
MQTT_PASSWORD=secret
CUSTOM_SETTING=keep-me
"""
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / "device.conf"
path.write_text(old)
ensure_device_config(path)
first = path.read_text()
config = read_device_config(path)
check("old bytes remain at the start", first.startswith(old))
check("channel survives", config.get("CHANNEL") == "canary")
check("MQTT host survives", config.get("MQTT_HOST") == "broker.example.test")
check("MQTT password survives", config.get("MQTT_PASSWORD") == "secret")
check("unknown settings survive", config.get("CUSTOM_SETTING") == "keep-me")
check("LIVE is appended once", first.count("LIVE_ENABLED=") == 1)
ensure_device_config(path)
second = path.read_text()
check("reinstall makes no further change", second == first)
check("LIVE still occurs once", second.count("LIVE_ENABLED=") == 1)
print()
print(f"passed: {passed} failed: {failed}")
raise SystemExit(1 if failed else 0)
PY