Name the race-window staging class on keep-site sleeps
Browse files at this commite1471df02bebbe48ed901fa372fa1fda02246290Parent: 4a9b76b- test
- name the race-window staging class on keep-site sleeps
5 changed files +11 -0
- tests/e2e.rs +4 -0
- tests/regress_course_delete.rs +1 -0
- tests/regress_exam_delete.rs +1 -0
- tests/regress_homework_orphans.rs +4 -0
- tests/regress_role_sweep.rs +1 -0
tests/e2e.rsmodified+4 -0
| @@ -1371,6 +1371,10 @@ async fn exam_room_close_after_a_retake_leaves_the_new_sitting_alone() { | |||
| 1371 | assert_eq!(body["attempt"], 2); | 1371 | assert_eq!(body["attempt"], 2); |
| 1372 | 1372 | ||
| 1373 | // Now walk out of the stale sitting-#1 room and give the teardown time. | 1373 | // Now walk out of the stale sitting-#1 room and give the teardown time. |
| 1374 | + // race-window staging — do not convert to poll: sitting #1 is terminal, so | ||
| 1375 | + // the teardown stamps nothing at all (`stamp_left` writes only an | ||
| 1376 | + // in-progress sitting), and the assertion below is that *no* stamp lands on | ||
| 1377 | + // sitting #2 — a negative with no positive to wait on. | ||
| 1374 | ws.close(None).await.unwrap(); | 1378 | ws.close(None).await.unwrap(); |
| 1375 | tokio::time::sleep(std::time::Duration::from_millis(500)).await; | 1379 | tokio::time::sleep(std::time::Duration::from_millis(500)).await; |
| 1376 | 1380 | ||
tests/regress_course_delete.rsmodified+1 -0
| @@ -221,6 +221,7 @@ async fn an_attempt_started_inside_a_course_delete_never_outlives_it() { | |||
| 221 | .await | 221 | .await |
| 222 | }) | 222 | }) |
| 223 | }; | 223 | }; |
| 224 | + // race-window staging — do not convert to poll | ||
| 224 | tokio::time::sleep(std::time::Duration::from_millis(300)).await; | 225 | tokio::time::sleep(std::time::Duration::from_millis(300)).await; |
| 225 | // The enrollment goes while the sitting is mid-write — the only staging in | 226 | // The enrollment goes while the sitting is mid-write — the only staging in |
| 226 | // which the delete is admitted at all. Without it this is a 409 and the | 227 | // which the delete is admitted at all. Without it this is a 409 and the |
tests/regress_exam_delete.rsmodified+1 -0
| @@ -90,6 +90,7 @@ async fn an_attempt_started_inside_a_delete_never_outlives_the_exam() { | |||
| 90 | }; | 90 | }; |
| 91 | // The start fires inside the held window: without the lease it reads an | 91 | // The start fires inside the held window: without the lease it reads an |
| 92 | // exam row the delete has removed but not committed. | 92 | // exam row the delete has removed but not committed. |
| 93 | + // race-window staging — do not convert to poll | ||
| 93 | tokio::time::sleep(std::time::Duration::from_millis(300)).await; | 94 | tokio::time::sleep(std::time::Duration::from_millis(300)).await; |
| 94 | let sit = { | 95 | let sit = { |
| 95 | let (app, student, exam) = (app.clone(), student.clone(), exam.clone()); | 96 | let (app, student, exam) = (app.clone(), student.clone(), exam.clone()); |
tests/regress_homework_orphans.rsmodified+4 -0
| @@ -146,6 +146,7 @@ async fn an_upload_inside_a_homework_delete_never_orphans() { | |||
| 146 | }; | 146 | }; |
| 147 | // The upload fires inside the held window: its gate reads a homework the | 147 | // The upload fires inside the held window: its gate reads a homework the |
| 148 | // delete has removed but not committed. | 148 | // delete has removed but not committed. |
| 149 | + // race-window staging — do not convert to poll | ||
| 149 | tokio::time::sleep(std::time::Duration::from_millis(1_000)).await; | 150 | tokio::time::sleep(std::time::Duration::from_millis(1_000)).await; |
| 150 | let uploaded = { | 151 | let uploaded = { |
| 151 | let (app, student, hw) = (app.clone(), student.clone(), hw.clone()); | 152 | let (app, student, hw) = (app.clone(), student.clone(), hw.clone()); |
| @@ -263,6 +264,7 @@ async fn an_upload_inside_an_audience_patch_is_refused() { | |||
| 263 | .await | 264 | .await |
| 264 | }) | 265 | }) |
| 265 | }; | 266 | }; |
| 267 | + // race-window staging — do not convert to poll | ||
| 266 | tokio::time::sleep(std::time::Duration::from_millis(1_000)).await; | 268 | tokio::time::sleep(std::time::Duration::from_millis(1_000)).await; |
| 267 | let uploaded = { | 269 | let uploaded = { |
| 268 | let (app, cookie, hw) = (app.clone(), dropped_student.clone(), hw.clone()); | 270 | let (app, cookie, hw) = (app.clone(), dropped_student.clone(), hw.clone()); |
| @@ -511,6 +513,7 @@ async fn a_grade_inside_a_course_delete_never_orphans() { | |||
| 511 | (res, started.elapsed()) | 513 | (res, started.elapsed()) |
| 512 | }) | 514 | }) |
| 513 | }; | 515 | }; |
| 516 | + // race-window staging — do not convert to poll | ||
| 514 | tokio::time::sleep(std::time::Duration::from_millis(1_000)).await; | 517 | tokio::time::sleep(std::time::Duration::from_millis(1_000)).await; |
| 515 | // The roster empties mid-grade — the only staging in which the course | 518 | // The roster empties mid-grade — the only staging in which the course |
| 516 | // delete is admitted at all. | 519 | // delete is admitted at all. |
| @@ -707,6 +710,7 @@ async fn a_file_add_racing_a_file_delete_never_500s() { | |||
| 707 | }; | 710 | }; |
| 708 | // The upload commits on the submission row while the delete is still | 711 | // The upload commits on the submission row while the delete is still |
| 709 | // holding its own write of it. | 712 | // holding its own write of it. |
| 713 | + // race-window staging — do not convert to poll | ||
| 710 | tokio::time::sleep(std::time::Duration::from_millis(40)).await; | 714 | tokio::time::sleep(std::time::Duration::from_millis(40)).await; |
| 711 | let added = upload_hw_file(&app, &student, &hw).await; | 715 | let added = upload_hw_file(&app, &student, &hw).await; |
| 712 | let removed = removing.await.unwrap(); | 716 | let removed = removing.await.unwrap(); |
tests/regress_role_sweep.rsmodified+1 -0
| @@ -108,6 +108,7 @@ async fn demote_in_the_window( | |||
| 108 | let (student, db) = (student.clone(), db.clone()); | 108 | let (student, db) = (student.clone(), db.clone()); |
| 109 | tokio::spawn(async move { demote(&student, to, &db).await }) | 109 | tokio::spawn(async move { demote(&student, to, &db).await }) |
| 110 | }; | 110 | }; |
| 111 | + // race-window staging — do not convert to poll | ||
| 111 | tokio::time::sleep(std::time::Duration::from_millis(400)).await; | 112 | tokio::time::sleep(std::time::Duration::from_millis(400)).await; |
| 112 | handle | 113 | handle |
| 113 | } | 114 | } |