upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/list.rs238
-rw-r--r--tests/pull.rs162
2 files changed, 214 insertions, 186 deletions
diff --git a/tests/list.rs b/tests/list.rs
index 4f55645..61c2201 100644
--- a/tests/list.rs
+++ b/tests/list.rs
@@ -1,6 +1,6 @@
1use anyhow::Result; 1use anyhow::Result;
2use futures::join; 2use futures::join;
3use nostr_sdk::client::blocking::Client; 3use nostr_sdk::client::Client;
4use serial_test::serial; 4use serial_test::serial;
5use test_utils::{git::GitTestRepo, relay::Relay, *}; 5use test_utils::{git::GitTestRepo, relay::Relay, *};
6 6
@@ -23,6 +23,7 @@ fn cli_tester_create_proposals() -> Result<GitTestRepo> {
23 Some((PROPOSAL_TITLE_1, "proposal a description")), 23 Some((PROPOSAL_TITLE_1, "proposal a description")),
24 None, 24 None,
25 )?; 25 )?;
26 std::thread::sleep(std::time::Duration::from_millis(1000));
26 cli_tester_create_proposal( 27 cli_tester_create_proposal(
27 &git_repo, 28 &git_repo,
28 FEATURE_BRANCH_NAME_2, 29 FEATURE_BRANCH_NAME_2,
@@ -30,6 +31,7 @@ fn cli_tester_create_proposals() -> Result<GitTestRepo> {
30 Some((PROPOSAL_TITLE_2, "proposal b description")), 31 Some((PROPOSAL_TITLE_2, "proposal b description")),
31 None, 32 None,
32 )?; 33 )?;
34 std::thread::sleep(std::time::Duration::from_millis(1000));
33 cli_tester_create_proposal( 35 cli_tester_create_proposal(
34 &git_repo, 36 &git_repo,
35 FEATURE_BRANCH_NAME_3, 37 FEATURE_BRANCH_NAME_3,
@@ -72,7 +74,7 @@ fn cli_tester_create_proposal(
72 in_reply_to: Option<String>, 74 in_reply_to: Option<String>,
73) -> Result<()> { 75) -> Result<()> {
74 create_and_populate_branch(test_repo, branch_name, prefix, false)?; 76 create_and_populate_branch(test_repo, branch_name, prefix, false)?;
75 77 std::thread::sleep(std::time::Duration::from_millis(1000));
76 if let Some(in_reply_to) = in_reply_to { 78 if let Some(in_reply_to) = in_reply_to {
77 let mut p = CliTester::new_from_dir( 79 let mut p = CliTester::new_from_dir(
78 &test_repo.dir, 80 &test_repo.dir,
@@ -190,7 +192,7 @@ mod cannot_find_repo_event {
190 input.succeeds_with( 192 input.succeeds_with(
191 &Coordinate { 193 &Coordinate {
192 kind: nostr::Kind::Custom(REPOSITORY_KIND), 194 kind: nostr::Kind::Custom(REPOSITORY_KIND),
193 pubkey: TEST_KEY_1_KEYS.public_key(), 195 public_key: TEST_KEY_1_KEYS.public_key(),
194 identifier: repo_event.identifier().unwrap().to_string(), 196 identifier: repo_event.identifier().unwrap().to_string(),
195 relays: vec!["ws://localhost:8056".to_string()], 197 relays: vec!["ws://localhost:8056".to_string()],
196 } 198 }
@@ -489,7 +491,7 @@ mod when_main_branch_is_uptodate {
489 "checked out proposal as '{FEATURE_BRANCH_NAME_3}' branch\r\n" 491 "checked out proposal as '{FEATURE_BRANCH_NAME_3}' branch\r\n"
490 ))?; 492 ))?;
491 p.expect_end()?; 493 p.expect_end()?;
492 494 println!("blablagothere");
493 for p in [51, 52, 53, 55, 56] { 495 for p in [51, 52, 53, 55, 56] {
494 relay::shutdown_relay(8000 + p)?; 496 relay::shutdown_relay(8000 + p)?;
495 } 497 }
@@ -726,6 +728,7 @@ mod when_main_branch_is_uptodate {
726 728
727 let cli_tester_handle = std::thread::spawn(move || -> Result<()> { 729 let cli_tester_handle = std::thread::spawn(move || -> Result<()> {
728 let originating_repo = cli_tester_create_proposals()?; 730 let originating_repo = cli_tester_create_proposals()?;
731 std::thread::sleep(std::time::Duration::from_millis(1000));
729 cli_tester_create_proposal( 732 cli_tester_create_proposal(
730 &originating_repo, 733 &originating_repo,
731 FEATURE_BRANCH_NAME_4, 734 FEATURE_BRANCH_NAME_4,
@@ -1589,6 +1592,8 @@ mod when_main_branch_is_uptodate {
1589 mod when_latest_revision_rebases_branch { 1592 mod when_latest_revision_rebases_branch {
1590 use std::time::Duration; 1593 use std::time::Duration;
1591 1594
1595 use tokio::{runtime::Handle, task::JoinHandle};
1596
1592 use super::*; 1597 use super::*;
1593 1598
1594 async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> { 1599 async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> {
@@ -1609,23 +1614,28 @@ mod when_main_branch_is_uptodate {
1609 r55.events.push(generate_test_key_1_metadata_event("fred")); 1614 r55.events.push(generate_test_key_1_metadata_event("fred"));
1610 r55.events.push(generate_test_key_1_relay_list_event()); 1615 r55.events.push(generate_test_key_1_relay_list_event());
1611 1616
1612 let cli_tester_handle = std::thread::spawn( 1617 let cli_tester_handle: JoinHandle<Result<(GitTestRepo, GitTestRepo)>> =
1613 move || -> Result<(GitTestRepo, GitTestRepo)> { 1618 tokio::task::spawn_blocking(move || {
1614 // create 3 proposals 1619 // create 3 proposals
1615 let _ = cli_tester_create_proposals()?; 1620 let _ = cli_tester_create_proposals()?;
1616 // get proposal id of first 1621 // get proposal id of first
1617 let client = Client::new(&nostr::Keys::generate()); 1622 // get proposal id of first
1618 client.add_relay("ws://localhost:8055")?; 1623 let client = Client::default();
1619 client.connect_relay("ws://localhost:8055")?; 1624 Handle::current().block_on(client.add_relay("ws://localhost:8055"))?;
1620 let proposals = client.get_events_of( 1625 Handle::current()
1626 .block_on(client.connect_relay("ws://localhost:8055"))?;
1627 let proposals = Handle::current().block_on(client.get_events_of(
1621 vec![ 1628 vec![
1622 nostr::Filter::default() 1629 nostr::Filter::default()
1623 .kind(nostr::Kind::Custom(PATCH_KIND)) 1630 .kind(nostr::Kind::Custom(PATCH_KIND))
1624 .custom_tag(nostr::Alphabet::T, vec!["root"]), 1631 .custom_tag(
1625 ], 1632 nostr::SingleLetterTag::lowercase(nostr::Alphabet::T),
1633 vec!["root"],
1634 ),
1635 ],
1626 Some(Duration::from_millis(500)), 1636 Some(Duration::from_millis(500)),
1627 )?; 1637 ))?;
1628 client.disconnect()?; 1638 Handle::current().block_on(client.disconnect())?;
1629 1639
1630 let proposal_1_id = proposals 1640 let proposal_1_id = proposals
1631 .iter() 1641 .iter()
@@ -1699,8 +1709,7 @@ mod when_main_branch_is_uptodate {
1699 relay::shutdown_relay(8000 + p)?; 1709 relay::shutdown_relay(8000 + p)?;
1700 } 1710 }
1701 Ok((second_originating_repo, test_repo)) 1711 Ok((second_originating_repo, test_repo))
1702 }, 1712 });
1703 );
1704 1713
1705 // launch relay 1714 // launch relay
1706 let _ = join!( 1715 let _ = join!(
@@ -1710,7 +1719,7 @@ mod when_main_branch_is_uptodate {
1710 r55.listen_until_close(), 1719 r55.listen_until_close(),
1711 r56.listen_until_close(), 1720 r56.listen_until_close(),
1712 ); 1721 );
1713 let res = cli_tester_handle.join().unwrap()?; 1722 let res = cli_tester_handle.await??;
1714 1723
1715 Ok(res) 1724 Ok(res)
1716 } 1725 }
@@ -1737,96 +1746,105 @@ mod when_main_branch_is_uptodate {
1737 r55.events.push(generate_test_key_1_metadata_event("fred")); 1746 r55.events.push(generate_test_key_1_metadata_event("fred"));
1738 r55.events.push(generate_test_key_1_relay_list_event()); 1747 r55.events.push(generate_test_key_1_relay_list_event());
1739 1748
1740 let cli_tester_handle = std::thread::spawn(move || -> Result<()> { 1749 let cli_tester_handle: JoinHandle<Result<()>> = tokio::task::spawn_blocking(
1741 // create 3 proposals 1750 move || {
1742 let _ = cli_tester_create_proposals()?; 1751 // create 3 proposals
1743 // get proposal id of first 1752 let _ = cli_tester_create_proposals()?;
1744 let client = Client::new(&nostr::Keys::generate()); 1753 // get proposal id of first
1745 client.add_relay("ws://localhost:8055")?; 1754 let client = Client::default();
1746 client.connect_relay("ws://localhost:8055")?; 1755 Handle::current()
1747 let proposals = client.get_events_of( 1756 .block_on(client.add_relay("ws://localhost:8055"))?;
1748 vec![ 1757 Handle::current()
1749 nostr::Filter::default() 1758 .block_on(client.connect_relay("ws://localhost:8055"))?;
1750 .kind(nostr::Kind::Custom(PATCH_KIND)) 1759 let proposals =
1751 .custom_tag(nostr::Alphabet::T, vec!["root"]), 1760 Handle::current().block_on(client.get_events_of(
1752 ], 1761 vec![
1753 Some(Duration::from_millis(500)), 1762 nostr::Filter::default()
1754 )?; 1763 .kind(nostr::Kind::Custom(PATCH_KIND))
1755 client.disconnect()?; 1764 .custom_tag(
1756 1765 nostr::SingleLetterTag::lowercase(nostr::Alphabet::T),
1757 let proposal_1_id = proposals 1766 vec!["root"],
1758 .iter() 1767 ),
1759 .find(|e| { 1768 ],
1760 e.tags 1769 Some(Duration::from_millis(500)),
1761 .iter() 1770 ))?;
1762 .any(|t| t.as_vec()[1].eq(&FEATURE_BRANCH_NAME_1)) 1771 Handle::current().block_on(client.disconnect())?;
1763 }) 1772
1764 .unwrap() 1773 let proposal_1_id = proposals
1765 .id; 1774 .iter()
1766 // recreate proposal 1 on top of a another commit (like a rebase on top 1775 .find(|e| {
1767 // of one extra commit) 1776 e.tags
1768 let second_originating_repo = GitTestRepo::default(); 1777 .iter()
1769 second_originating_repo.populate()?; 1778 .any(|t| t.as_vec()[1].eq(&FEATURE_BRANCH_NAME_1))
1770 std::fs::write( 1779 })
1771 second_originating_repo.dir.join("amazing.md"), 1780 .unwrap()
1772 "some content", 1781 .id;
1773 )?; 1782 // recreate proposal 1 on top of a another commit (like a rebase on
1774 second_originating_repo 1783 // top of one extra commit)
1775 .stage_and_commit("commit for rebasing on top of")?; 1784 let second_originating_repo = GitTestRepo::default();
1776 cli_tester_create_proposal( 1785 second_originating_repo.populate()?;
1777 &second_originating_repo, 1786 std::fs::write(
1778 FEATURE_BRANCH_NAME_1, 1787 second_originating_repo.dir.join("amazing.md"),
1779 "a", 1788 "some content",
1780 Some((PROPOSAL_TITLE_1, "proposal a description")), 1789 )?;
1781 Some(proposal_1_id.to_string()), 1790 second_originating_repo
1782 )?; 1791 .stage_and_commit("commit for rebasing on top of")?;
1783 1792 cli_tester_create_proposal(
1784 // pretend we have downloaded the origianl version of the first proposal 1793 &second_originating_repo,
1785 let test_repo = GitTestRepo::default(); 1794 FEATURE_BRANCH_NAME_1,
1786 test_repo.populate()?; 1795 "a",
1787 create_and_populate_branch( 1796 Some((PROPOSAL_TITLE_1, "proposal a description")),
1788 &test_repo, 1797 Some(proposal_1_id.to_string()),
1789 FEATURE_BRANCH_NAME_1, 1798 )?;
1790 "a", 1799
1791 false, 1800 // pretend we have downloaded the origianl version of the first
1792 )?; 1801 // proposal
1793 // pretend we have pulled the updated main branch 1802 let test_repo = GitTestRepo::default();
1794 test_repo.checkout("main")?; 1803 test_repo.populate()?;
1795 std::fs::write(test_repo.dir.join("amazing.md"), "some content")?; 1804 create_and_populate_branch(
1796 test_repo.stage_and_commit("commit for rebasing on top of")?; 1805 &test_repo,
1797 1806 FEATURE_BRANCH_NAME_1,
1798 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 1807 "a",
1799 p.expect("finding proposals...\r\n")?; 1808 false,
1800 let mut c = p.expect_choice( 1809 )?;
1801 "all proposals", 1810 // pretend we have pulled the updated main branch
1802 vec![ 1811 test_repo.checkout("main")?;
1803 format!("\"{PROPOSAL_TITLE_3}\""), 1812 std::fs::write(test_repo.dir.join("amazing.md"), "some content")?;
1804 format!("\"{PROPOSAL_TITLE_2}\""), 1813 test_repo.stage_and_commit("commit for rebasing on top of")?;
1805 format!("\"{PROPOSAL_TITLE_1}\""), 1814
1806 ], 1815 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
1807 )?; 1816 p.expect("finding proposals...\r\n")?;
1808 c.succeeds_with(2, true, None)?; 1817 let mut c = p.expect_choice(
1809 p.expect("finding commits...\r\n")?; 1818 "all proposals",
1810 p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?; 1819 vec![
1811 let mut c = p.expect_choice( 1820 format!("\"{PROPOSAL_TITLE_3}\""),
1812 "", 1821 format!("\"{PROPOSAL_TITLE_2}\""),
1813 vec![ 1822 format!("\"{PROPOSAL_TITLE_1}\""),
1814 format!("checkout and overwrite existing proposal branch"), 1823 ],
1815 format!("checkout existing outdated proposal branch"), 1824 )?;
1816 format!("apply to current branch with `git am`"), 1825 c.succeeds_with(2, true, None)?;
1817 format!("download to ./patches"), 1826 p.expect("finding commits...\r\n")?;
1818 format!("back"), 1827 p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?;
1819 ], 1828 let mut c = p.expect_choice(
1820 )?; 1829 "",
1821 c.succeeds_with(0, false, Some(0))?; 1830 vec![
1822 p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; 1831 format!("checkout and overwrite existing proposal branch"),
1823 p.expect_end()?; 1832 format!("checkout existing outdated proposal branch"),
1824 1833 format!("apply to current branch with `git am`"),
1825 for p in [51, 52, 53, 55, 56] { 1834 format!("download to ./patches"),
1826 relay::shutdown_relay(8000 + p)?; 1835 format!("back"),
1827 } 1836 ],
1828 Ok(()) 1837 )?;
1829 }); 1838 c.succeeds_with(0, false, Some(0))?;
1839 p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?;
1840 p.expect_end()?;
1841
1842 for p in [51, 52, 53, 55, 56] {
1843 relay::shutdown_relay(8000 + p)?;
1844 }
1845 Ok(())
1846 },
1847 );
1830 1848
1831 // launch relay 1849 // launch relay
1832 let _ = join!( 1850 let _ = join!(
@@ -1836,7 +1854,7 @@ mod when_main_branch_is_uptodate {
1836 r55.listen_until_close(), 1854 r55.listen_until_close(),
1837 r56.listen_until_close(), 1855 r56.listen_until_close(),
1838 ); 1856 );
1839 cli_tester_handle.join().unwrap()?; 1857 cli_tester_handle.await??;
1840 println!("{:?}", r55.events); 1858 println!("{:?}", r55.events);
1841 Ok(()) 1859 Ok(())
1842 } 1860 }
diff --git a/tests/pull.rs b/tests/pull.rs
index 50dddbf..bf132e7 100644
--- a/tests/pull.rs
+++ b/tests/pull.rs
@@ -712,7 +712,8 @@ mod when_branch_is_checked_out {
712 mod when_latest_event_rebases_branch { 712 mod when_latest_event_rebases_branch {
713 use std::time::Duration; 713 use std::time::Duration;
714 714
715 use nostr_sdk::blocking::Client; 715 use nostr_sdk::Client;
716 use tokio::{runtime::Handle, task::JoinHandle};
716 717
717 use super::*; 718 use super::*;
718 719
@@ -734,23 +735,26 @@ mod when_branch_is_checked_out {
734 r55.events.push(generate_test_key_1_metadata_event("fred")); 735 r55.events.push(generate_test_key_1_metadata_event("fred"));
735 r55.events.push(generate_test_key_1_relay_list_event()); 736 r55.events.push(generate_test_key_1_relay_list_event());
736 737
737 let cli_tester_handle = 738 let cli_tester_handle: JoinHandle<Result<(GitTestRepo, GitTestRepo)>> =
738 std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { 739 tokio::task::spawn_blocking(move || {
739 // create 3 proposals 740 // create 3 proposals
740 let _ = cli_tester_create_proposals()?; 741 let _ = cli_tester_create_proposals()?;
741 // get proposal id of first 742 // get proposal id of first
742 let client = Client::new(&nostr::Keys::generate()); 743 let client = Client::default();
743 client.add_relay("ws://localhost:8055")?; 744 Handle::current().block_on(client.add_relay("ws://localhost:8055"))?;
744 client.connect_relay("ws://localhost:8055")?; 745 Handle::current().block_on(client.connect_relay("ws://localhost:8055"))?;
745 let proposals = client.get_events_of( 746 let proposals = Handle::current().block_on(client.get_events_of(
746 vec![ 747 vec![
747 nostr::Filter::default() 748 nostr::Filter::default()
748 .kind(nostr::Kind::Custom(PATCH_KIND)) 749 .kind(nostr::Kind::Custom(PATCH_KIND))
749 .custom_tag(nostr::Alphabet::T, vec!["root"]), 750 .custom_tag(
750 ], 751 nostr::SingleLetterTag::lowercase(nostr::Alphabet::T),
752 vec!["root"],
753 ),
754 ],
751 Some(Duration::from_millis(500)), 755 Some(Duration::from_millis(500)),
752 )?; 756 ))?;
753 client.disconnect()?; 757 Handle::current().block_on(client.disconnect())?;
754 758
755 let proposal_1_id = proposals 759 let proposal_1_id = proposals
756 .iter() 760 .iter()
@@ -805,7 +809,7 @@ mod when_branch_is_checked_out {
805 r55.listen_until_close(), 809 r55.listen_until_close(),
806 r56.listen_until_close(), 810 r56.listen_until_close(),
807 ); 811 );
808 let res = cli_tester_handle.join().unwrap()?; 812 let res = cli_tester_handle.await??;
809 813
810 Ok(res) 814 Ok(res)
811 } 815 }
@@ -832,69 +836,75 @@ mod when_branch_is_checked_out {
832 r55.events.push(generate_test_key_1_metadata_event("fred")); 836 r55.events.push(generate_test_key_1_metadata_event("fred"));
833 r55.events.push(generate_test_key_1_relay_list_event()); 837 r55.events.push(generate_test_key_1_relay_list_event());
834 838
835 let cli_tester_handle = std::thread::spawn(move || -> Result<()> { 839 let cli_tester_handle: JoinHandle<Result<()>> = tokio::task::spawn_blocking(
836 // create 3 proposals 840 move || {
837 let _ = cli_tester_create_proposals()?; 841 // create 3 proposals
838 // get proposal id of first 842 let _ = cli_tester_create_proposals()?;
839 let client = Client::new(&nostr::Keys::generate()); 843 // get proposal id of first
840 client.add_relay("ws://localhost:8055")?; 844 let client = Client::default();
841 client.connect_relay("ws://localhost:8055")?; 845 Handle::current().block_on(client.add_relay("ws://localhost:8055"))?;
842 let proposals = client.get_events_of( 846 Handle::current().block_on(client.connect_relay("ws://localhost:8055"))?;
843 vec![ 847 let proposals = Handle::current().block_on(client.get_events_of(
844 nostr::Filter::default() 848 vec![
845 .kind(nostr::Kind::Custom(PATCH_KIND)) 849 nostr::Filter::default()
846 .custom_tag(nostr::Alphabet::T, vec!["root"]), 850 .kind(nostr::Kind::Custom(PATCH_KIND))
847 ], 851 .custom_tag(
848 Some(Duration::from_millis(500)), 852 nostr::SingleLetterTag::lowercase(nostr::Alphabet::T),
849 )?; 853 vec!["root"],
850 client.disconnect()?; 854 ),
851 855 ],
852 let proposal_1_id = proposals 856 Some(Duration::from_millis(500)),
853 .iter() 857 ))?;
854 .find(|e| { 858 Handle::current().block_on(client.disconnect())?;
855 e.tags 859
856 .iter() 860 let proposal_1_id = proposals
857 .any(|t| t.as_vec()[1].eq(&FEATURE_BRANCH_NAME_1)) 861 .iter()
858 }) 862 .find(|e| {
859 .unwrap() 863 e.tags
860 .id; 864 .iter()
861 // recreate proposal 1 on top of a another commit (like a rebase on top 865 .any(|t| t.as_vec()[1].eq(&FEATURE_BRANCH_NAME_1))
862 // of one extra commit) 866 })
863 let second_originating_repo = GitTestRepo::default(); 867 .unwrap()
864 second_originating_repo.populate()?; 868 .id;
865 std::fs::write( 869 // recreate proposal 1 on top of a another commit (like a rebase on top
866 second_originating_repo.dir.join("amazing.md"), 870 // of one extra commit)
867 "some content", 871 let second_originating_repo = GitTestRepo::default();
868 )?; 872 second_originating_repo.populate()?;
869 second_originating_repo.stage_and_commit("commit for rebasing on top of")?; 873 std::fs::write(
870 cli_tester_create_proposal( 874 second_originating_repo.dir.join("amazing.md"),
871 &second_originating_repo, 875 "some content",
872 FEATURE_BRANCH_NAME_1, 876 )?;
873 "a", 877 second_originating_repo
874 Some((PROPOSAL_TITLE_1, "proposal a description")), 878 .stage_and_commit("commit for rebasing on top of")?;
875 Some(proposal_1_id.to_string()), 879 cli_tester_create_proposal(
876 )?; 880 &second_originating_repo,
877 881 FEATURE_BRANCH_NAME_1,
878 // pretend we have downloaded the origianl version of the first proposal 882 "a",
879 let test_repo = GitTestRepo::default(); 883 Some((PROPOSAL_TITLE_1, "proposal a description")),
880 test_repo.populate()?; 884 Some(proposal_1_id.to_string()),
881 create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?; 885 )?;
882 // pretend we have pulled the updated main branch 886
883 test_repo.checkout("main")?; 887 // pretend we have downloaded the origianl version of the first proposal
884 std::fs::write(test_repo.dir.join("amazing.md"), "some content")?; 888 let test_repo = GitTestRepo::default();
885 test_repo.stage_and_commit("commit for rebasing on top of")?; 889 test_repo.populate()?;
886 test_repo.checkout(FEATURE_BRANCH_NAME_1)?; 890 create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?;
891 // pretend we have pulled the updated main branch
892 test_repo.checkout("main")?;
893 std::fs::write(test_repo.dir.join("amazing.md"), "some content")?;
894 test_repo.stage_and_commit("commit for rebasing on top of")?;
895 test_repo.checkout(FEATURE_BRANCH_NAME_1)?;
887 896
888 let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); 897 let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]);
889 p.expect("finding proposal root event...\r\n")?; 898 p.expect("finding proposal root event...\r\n")?;
890 p.expect("found proposal root event. finding commits...\r\n")?; 899 p.expect("found proposal root event. finding commits...\r\n")?;
891 p.expect_end_with("pulled new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; 900 p.expect_end_with("pulled new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?;
892 901
893 for p in [51, 52, 53, 55, 56] { 902 for p in [51, 52, 53, 55, 56] {
894 relay::shutdown_relay(8000 + p)?; 903 relay::shutdown_relay(8000 + p)?;
895 } 904 }
896 Ok(()) 905 Ok(())
897 }); 906 },
907 );
898 908
899 // launch relay 909 // launch relay
900 let _ = join!( 910 let _ = join!(
@@ -904,7 +914,7 @@ mod when_branch_is_checked_out {
904 r55.listen_until_close(), 914 r55.listen_until_close(),
905 r56.listen_until_close(), 915 r56.listen_until_close(),
906 ); 916 );
907 cli_tester_handle.join().unwrap()?; 917 cli_tester_handle.await??;
908 println!("{:?}", r55.events); 918 println!("{:?}", r55.events);
909 Ok(()) 919 Ok(())
910 } 920 }