upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/push.rs
diff options
context:
space:
mode:
authorjk <email@jkrause.io>2024-01-31 15:13:52 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-02-02 07:21:01 +0000
commitab1450c655f7fdfc214e1556d16fc754ca684613 (patch)
tree9ded305354a272d411059493e9475a3e39ff5cae /tests/push.rs
parentccdbc337ae16d7c70be44166269c8b2d5b9f5c09 (diff)
test: replace block_on with tokio::tests
This is intended to improve the reliabilty of the tests. there have been particular issues with random tests never ending when run in the nix configuration see discussion here https://github.com/DanConwayDev/ngit-cli/issues/ 6#issuecomment-1918971239 and: https://github.com/DanConwayDev/ngit-cli/pull/7
Diffstat (limited to 'tests/push.rs')
-rw-r--r--tests/push.rs34
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/push.rs b/tests/push.rs
index 4fdb6eb..4af5bd4 100644
--- a/tests/push.rs
+++ b/tests/push.rs
@@ -111,6 +111,7 @@ mod when_pr_isnt_associated_with_branch_name {
111 use super::*; 111 use super::*;
112 112
113 mod cli_prompts { 113 mod cli_prompts {
114
114 use super::*; 115 use super::*;
115 async fn run_async_cli_show_error() -> Result<()> { 116 async fn run_async_cli_show_error() -> Result<()> {
116 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 117 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
@@ -164,10 +165,10 @@ mod when_pr_isnt_associated_with_branch_name {
164 Ok(()) 165 Ok(())
165 } 166 }
166 167
167 #[test] 168 #[tokio::test]
168 #[serial] 169 #[serial]
169 fn cli_show_error() -> Result<()> { 170 async fn cli_show_error() -> Result<()> {
170 futures::executor::block_on(run_async_cli_show_error()) 171 run_async_cli_show_error().await
171 } 172 }
172 } 173 }
173} 174}
@@ -229,10 +230,11 @@ mod when_branch_is_checked_out {
229 Ok(()) 230 Ok(())
230 } 231 }
231 232
232 #[test] 233 #[tokio::test]
233 #[serial] 234 #[serial]
234 fn cli_show_up_to_date() -> Result<()> { 235 async fn cli_show_up_to_date() -> Result<()> {
235 futures::executor::block_on(run_async_cli_show_up_to_date()) 236 let _ = run_async_cli_show_up_to_date().await;
237 Ok(())
236 } 238 }
237 } 239 }
238 } 240 }
@@ -291,10 +293,11 @@ mod when_branch_is_checked_out {
291 Ok(()) 293 Ok(())
292 } 294 }
293 295
294 #[test] 296 #[tokio::test]
295 #[serial] 297 #[serial]
296 fn cli_show_up_to_date() -> Result<()> { 298 async fn cli_show_up_to_date() -> Result<()> {
297 futures::executor::block_on(run_async_cli_show_up_to_date()) 299 let _ = run_async_cli_show_up_to_date().await;
300 Ok(())
298 } 301 }
299 } 302 }
300 } 303 }
@@ -389,10 +392,11 @@ mod when_branch_is_checked_out {
389 Ok(()) 392 Ok(())
390 } 393 }
391 394
392 #[test] 395 #[tokio::test]
393 #[serial] 396 #[serial]
394 fn cli_applied_1_commit() -> Result<()> { 397 async fn cli_applied_1_commit() -> Result<()> {
395 futures::executor::block_on(run_async_cli_applied_1_commit()) 398 let _ = run_async_cli_applied_1_commit().await;
399 Ok(())
396 } 400 }
397 } 401 }
398 402
@@ -453,10 +457,10 @@ mod when_branch_is_checked_out {
453 457
454 Ok((res, r55.events.clone())) 458 Ok((res, r55.events.clone()))
455 } 459 }
456 #[test] 460 #[tokio::test]
457 #[serial] 461 #[serial]
458 fn commits_issued_as_patch_event() -> Result<()> { 462 async fn commits_issued_as_patch_event() -> Result<()> {
459 let (test_repo, r55_events) = futures::executor::block_on(prep_and_run())?; 463 let (test_repo, r55_events) = prep_and_run().await?;
460 464
461 let commit_id = test_repo 465 let commit_id = test_repo
462 .get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)? 466 .get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?