upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/pull.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-03-04 10:54:38 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-03-04 10:54:38 +0000
commitb02b4754c027bd751825c8e3b96766a5898187b1 (patch)
tree5d82b0a1f3094eb5cc7968d4607fd51d713f3bba /tests/pull.rs
parent6e48a90620cc083ab3617a6583123de9e721b181 (diff)
test: ensure failed tests timeout
resolve a long standing test issue where failures to output the correct message in the cli would result in the test never ending rather than failing the many test cases updated in this change are to ensure failures are caught rather than ignored some of them are just refactored to remove calling an extra function, which is no longer needed note: this doesn't fix the intermittent issue, most commonly experienced under the nix configuration, where tests that should pass occationally never end preventing the rest of the suite from running
Diffstat (limited to 'tests/pull.rs')
-rw-r--r--tests/pull.rs90
1 files changed, 30 insertions, 60 deletions
diff --git a/tests/pull.rs b/tests/pull.rs
index ee8cad1..77ff87b 100644
--- a/tests/pull.rs
+++ b/tests/pull.rs
@@ -127,7 +127,10 @@ mod when_main_is_checked_out {
127 127
128 mod cli_prompts { 128 mod cli_prompts {
129 use super::*; 129 use super::*;
130 async fn run_async_cli_show_error() -> Result<()> { 130
131 #[tokio::test]
132 #[serial]
133 async fn cli_show_error() -> Result<()> {
131 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 134 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
132 Relay::new(8051, None, None), 135 Relay::new(8051, None, None),
133 Relay::new(8052, None, None), 136 Relay::new(8052, None, None),
@@ -174,12 +177,6 @@ mod when_main_is_checked_out {
174 cli_tester_handle.join().unwrap()?; 177 cli_tester_handle.join().unwrap()?;
175 Ok(()) 178 Ok(())
176 } 179 }
177
178 #[tokio::test]
179 #[serial]
180 async fn cli_show_error() -> Result<()> {
181 run_async_cli_show_error().await
182 }
183 } 180 }
184} 181}
185 182
@@ -188,7 +185,10 @@ mod when_branch_doesnt_exist {
188 185
189 mod cli_prompts { 186 mod cli_prompts {
190 use super::*; 187 use super::*;
191 async fn run_async_cli_show_error() -> Result<()> { 188
189 #[tokio::test]
190 #[serial]
191 async fn cli_show_error() -> Result<()> {
192 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 192 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
193 Relay::new(8051, None, None), 193 Relay::new(8051, None, None),
194 Relay::new(8052, None, None), 194 Relay::new(8052, None, None),
@@ -239,12 +239,6 @@ mod when_branch_doesnt_exist {
239 cli_tester_handle.join().unwrap()?; 239 cli_tester_handle.join().unwrap()?;
240 Ok(()) 240 Ok(())
241 } 241 }
242
243 #[tokio::test]
244 #[serial]
245 async fn cli_show_error() -> Result<()> {
246 run_async_cli_show_error().await
247 }
248 } 242 }
249} 243}
250 244
@@ -256,7 +250,9 @@ mod when_branch_is_checked_out {
256 250
257 mod cli_prompts { 251 mod cli_prompts {
258 use super::*; 252 use super::*;
259 async fn run_async_cli_show_up_to_date() -> Result<()> { 253 #[tokio::test]
254 #[serial]
255 async fn cli_show_up_to_date() -> Result<()> {
260 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 256 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
261 Relay::new(8051, None, None), 257 Relay::new(8051, None, None),
262 Relay::new(8052, None, None), 258 Relay::new(8052, None, None),
@@ -304,12 +300,6 @@ mod when_branch_is_checked_out {
304 cli_tester_handle.join().unwrap()?; 300 cli_tester_handle.join().unwrap()?;
305 Ok(()) 301 Ok(())
306 } 302 }
307
308 #[tokio::test]
309 #[serial]
310 async fn cli_show_up_to_date() -> Result<()> {
311 run_async_cli_show_up_to_date().await
312 }
313 } 303 }
314 } 304 }
315 305
@@ -368,7 +358,9 @@ mod when_branch_is_checked_out {
368 mod cli_prompts { 358 mod cli_prompts {
369 use super::*; 359 use super::*;
370 360
371 async fn run_async_cli_applied_1_commit() -> Result<()> { 361 #[tokio::test]
362 #[serial]
363 async fn cli_applied_1_commit() -> Result<()> {
372 // fallback (51,52) user write (53, 55) repo (55, 56) 364 // fallback (51,52) user write (53, 55) repo (55, 56)
373 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 365 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
374 Relay::new(8051, None, None), 366 Relay::new(8051, None, None),
@@ -419,12 +411,6 @@ mod when_branch_is_checked_out {
419 411
420 Ok(()) 412 Ok(())
421 } 413 }
422
423 #[tokio::test]
424 #[serial]
425 async fn cli_applied_1_commit() -> Result<()> {
426 run_async_cli_applied_1_commit().await
427 }
428 } 414 }
429 415
430 #[tokio::test] 416 #[tokio::test]
@@ -444,7 +430,10 @@ mod when_branch_is_checked_out {
444 430
445 mod cli_prompts { 431 mod cli_prompts {
446 use super::*; 432 use super::*;
447 async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { 433
434 #[tokio::test]
435 #[serial]
436 async fn cli_output_correct() -> Result<()> {
448 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 437 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
449 Relay::new(8051, None, None), 438 Relay::new(8051, None, None),
450 Relay::new(8052, None, None), 439 Relay::new(8052, None, None),
@@ -509,13 +498,6 @@ mod when_branch_is_checked_out {
509 println!("{:?}", r55.events); 498 println!("{:?}", r55.events);
510 Ok(()) 499 Ok(())
511 } 500 }
512
513 #[tokio::test]
514 #[serial]
515 async fn cli_output_correct() -> Result<()> {
516 let _ = run_async_prompts_to_choose_from_proposal_titles().await;
517 Ok(())
518 }
519 } 501 }
520 } 502 }
521 503
@@ -524,7 +506,10 @@ mod when_branch_is_checked_out {
524 506
525 mod cli_prompts { 507 mod cli_prompts {
526 use super::*; 508 use super::*;
527 async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { 509
510 #[tokio::test]
511 #[serial]
512 async fn cli_output_correct() -> Result<()> {
528 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 513 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
529 Relay::new(8051, None, None), 514 Relay::new(8051, None, None),
530 Relay::new(8052, None, None), 515 Relay::new(8052, None, None),
@@ -589,13 +574,6 @@ mod when_branch_is_checked_out {
589 println!("{:?}", r55.events); 574 println!("{:?}", r55.events);
590 Ok(()) 575 Ok(())
591 } 576 }
592
593 #[tokio::test]
594 #[serial]
595 async fn cli_output_correct() -> Result<()> {
596 let _ = run_async_prompts_to_choose_from_proposal_titles().await;
597 Ok(())
598 }
599 } 577 }
600 } 578 }
601 579
@@ -659,7 +637,10 @@ mod when_branch_is_checked_out {
659 637
660 mod cli_prompts { 638 mod cli_prompts {
661 use super::*; 639 use super::*;
662 async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { 640
641 #[tokio::test]
642 #[serial]
643 async fn prompts_to_choose_from_proposal_titles() -> Result<()> {
663 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 644 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
664 Relay::new(8051, None, None), 645 Relay::new(8051, None, None),
665 Relay::new(8052, None, None), 646 Relay::new(8052, None, None),
@@ -711,13 +692,6 @@ mod when_branch_is_checked_out {
711 println!("{:?}", r55.events); 692 println!("{:?}", r55.events);
712 Ok(()) 693 Ok(())
713 } 694 }
714
715 #[tokio::test]
716 #[serial]
717 async fn prompts_to_choose_from_proposal_titles() -> Result<()> {
718 let _ = run_async_prompts_to_choose_from_proposal_titles().await;
719 Ok(())
720 }
721 } 695 }
722 696
723 #[tokio::test] 697 #[tokio::test]
@@ -835,7 +809,10 @@ mod when_branch_is_checked_out {
835 809
836 mod cli_prompts { 810 mod cli_prompts {
837 use super::*; 811 use super::*;
838 async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { 812
813 #[tokio::test]
814 #[serial]
815 async fn prompts_to_choose_from_proposal_titles() -> Result<()> {
839 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 816 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
840 Relay::new(8051, None, None), 817 Relay::new(8051, None, None),
841 Relay::new(8052, None, None), 818 Relay::new(8052, None, None),
@@ -928,13 +905,6 @@ mod when_branch_is_checked_out {
928 println!("{:?}", r55.events); 905 println!("{:?}", r55.events);
929 Ok(()) 906 Ok(())
930 } 907 }
931
932 #[tokio::test]
933 #[serial]
934 async fn prompts_to_choose_from_proposal_titles() -> Result<()> {
935 let _ = run_async_prompts_to_choose_from_proposal_titles().await;
936 Ok(())
937 }
938 } 908 }
939 909
940 #[tokio::test] 910 #[tokio::test]