Skip to main content

Module testing

Module testing 

Source
Expand description

Test-mode setup the system tests drive through the mock Suotar control routes. Nothing here belongs on a live path: each helper writes a stamp or a hold the pipeline otherwise owns.

Functions§

expire_enrolment_recheck_allowance_for_testing
Backdates the row’s last enrolment check and last check request past the limit on asking, and the row itself past the student’s first-hour wait, so a spec can press a recheck button without waiting either out. With clear_restarts, also forgets the day’s restarts. Exists only for test setup.
make_enrolment_checks_due_for_testing
Makes every row in scope that waits for an enrolment check due now, as if its next rung had come, and returns how many it moved. Exists only for test setup: specs cannot wait out a day for a row’s first check.
set_first_failed_at_for_testing
Backdates first_failed_at for a registration, so a test can simulate a retry window that started long enough ago for its retry limit to have elapsed.
set_state_entered_at_for_testing
Backdates state_entered_at for a registration, so a test can simulate a row that has been sitting in its state long enough for a backoff or timeout to fire.
set_test_exclusive_hold_for_testing
Excuses every one of a user’s rows (or, with course_id, just that course’s) from every unscoped claim until held_until; a scoped claim ignores every hold regardless. Keyed on identity rather than a row id so a spec can hold before materialize creates the row it means to protect, closing the window a row-id hold could only ever narrow: the live background worker ticks every 10s regardless of any single test, so a hold applied after the row exists still races the worker’s own next tick.