| ... | @@ -837,27 +837,16 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() { | ... | @@ -837,27 +837,16 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() { |
| 837 | let mut faulty = server::Server::new(&source); | 837 | let mut faulty = server::Server::new(&source); |
| 838 | faulty.fault = server::Fault::UnknownBefore; | 838 | faulty.fault = server::Fault::UnknownBefore; |
| 839 | assert!(replica.sync_once(&mut faulty).is_err()); | 839 | assert!(replica.sync_once(&mut faulty).is_err()); |
| | 840 | let attempted = replica.status(id).unwrap(); |
| 840 | assert!(matches!( | 841 | assert!(matches!( |
| 841 | replica.status(id).unwrap(), | 842 | attempted, |
| 842 | Some(EditStatus::AwaitingConfirmation { .. }) | 843 | Some(EditStatus::AwaitingConfirmation { .. }) |
| 843 | )); | 844 | )); |
| 844 | drop(replica); | 845 | drop(replica); |
| 845 | | 846 | |
| 846 | let notified = Arc::new(AtomicUsize::new(0)); | 847 | let section = |
| 847 | let counter = Arc::clone(&notified); | 848 | Section::resume(&file, notebook::Replica::open(&cache).unwrap(), true, || {}).unwrap(); |
| 848 | let section = Section::resume( | 849 | assert_eq!(section.status(id).unwrap(), attempted); |
| 849 | &file, | | |
| 850 | notebook::Replica::open(&cache).unwrap(), | | |
| 851 | false, | | |
| 852 | move || { | | |
| 853 | counter.fetch_add(1, Ordering::SeqCst); | | |
| 854 | }, | | |
| 855 | ) | | |
| 856 | .unwrap(); | | |
| 857 | wait( | | |
| 858 | &section, | | |
| 859 | |event| matches!(event, Event::Attempt { id: n, status: EditStatus::AwaitingConfirmation { .. } } if *n == id), | | |
| 860 | ); | | |
| 861 | assert_eq!( | 850 | assert_eq!( |
| 862 | section | 851 | section |
| 863 | .pending() | 852 | .pending() |
| ... | @@ -872,6 +861,7 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() { | ... | @@ -872,6 +861,7 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() { |
| 872 | if continued { | 861 | if continued { |
| 873 | section.release(id, &archive, Resolution::Mine).unwrap(); | 862 | section.release(id, &archive, Resolution::Mine).unwrap(); |
| 874 | assert_eq!(section.status(id).unwrap(), Some(EditStatus::Pending)); | 863 | assert_eq!(section.status(id).unwrap(), Some(EditStatus::Pending)); |
| | 864 | section.set_offline(false); |
| 875 | published(&section, id); | 865 | published(&section, id); |
| 876 | assert_same(stored_page(&file, space), &local); | 866 | assert_same(stored_page(&file, space), &local); |
| 877 | } else { | 867 | } else { |
| ... | @@ -887,10 +877,7 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() { | ... | @@ -887,10 +877,7 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() { |
| 887 | } | 877 | } |
| 888 | let recovery = Recovery::open(&archive).unwrap(); | 878 | let recovery = Recovery::open(&archive).unwrap(); |
| 889 | assert_eq!(recovery.pending().unwrap().len(), 1); | 879 | assert_eq!(recovery.pending().unwrap().len(), 1); |
| 890 | assert!(matches!( | 880 | assert_eq!(recovery.status(id).unwrap(), attempted); |
| 891 | recovery.status(id).unwrap(), | | |
| 892 | Some(EditStatus::AwaitingConfirmation { .. }) | | |
| 893 | )); | | |
| 894 | assert!(section.pending().unwrap().is_empty()); | 881 | assert!(section.pending().unwrap().is_empty()); |
| 895 | assert!( | 882 | assert!( |
| 896 | section | 883 | section |