@@ -40,7 +40,11 @@ pub async fn init_coffee_test_cmd() -> anyhow::Result<()> {
4040 let root_path = manager. root_path ( ) . to_owned ( ) ;
4141 manager
4242 . coffee ( )
43- . add_remote ( "folgore" , "https://github.com/coffee-tools/folgore.git" )
43+ . add_remote (
44+ "folgore" ,
45+ "https://github.com/coffee-tools/folgore.git" ,
46+ false ,
47+ )
4448 . await
4549 . unwrap ( ) ;
4650
@@ -107,7 +111,11 @@ pub async fn init_coffee_test_add_remote() {
107111
108112 manager
109113 . coffee ( )
110- . add_remote ( "lightningd" , "https://github.com/lightningd/plugins.git" )
114+ . add_remote (
115+ "lightningd" ,
116+ "https://github.com/lightningd/plugins.git" ,
117+ false ,
118+ )
111119 . await
112120 . unwrap ( ) ;
113121 manager
@@ -141,7 +149,7 @@ pub async fn test_add_remove_plugins() {
141149 let repo_url = "https://github.com/lightningd/plugins.git" ;
142150 manager
143151 . coffee ( )
144- . add_remote ( repo_name, repo_url)
152+ . add_remote ( repo_name, repo_url, false )
145153 . await
146154 . unwrap ( ) ;
147155
@@ -260,7 +268,7 @@ pub async fn test_errors_and_show() {
260268 let repo_url = "https://github.com/lightningd/plugins.git" ;
261269 manager
262270 . coffee ( )
263- . add_remote ( repo_name, repo_url)
271+ . add_remote ( repo_name, repo_url, false )
264272 . await
265273 . unwrap ( ) ;
266274
@@ -346,7 +354,11 @@ pub async fn install_plugin_in_two_networks() -> anyhow::Result<()> {
346354 // Add lightningd remote repository
347355 manager
348356 . coffee ( )
349- . add_remote ( "lightningd" , "https://github.com/lightningd/plugins.git" )
357+ . add_remote (
358+ "lightningd" ,
359+ "https://github.com/lightningd/plugins.git" ,
360+ false ,
361+ )
350362 . await
351363 . unwrap ( ) ;
352364 // Install summary plugin
@@ -386,7 +398,11 @@ pub async fn install_plugin_in_two_networks() -> anyhow::Result<()> {
386398
387399 let result = manager
388400 . coffee ( )
389- . add_remote ( "lightningd" , "https://github.com/lightningd/plugins.git" )
401+ . add_remote (
402+ "lightningd" ,
403+ "https://github.com/lightningd/plugins.git" ,
404+ false ,
405+ )
390406 . await ;
391407 assert ! ( result. is_err( ) , "{:?}" , result) ;
392408 // Install summary plugin
@@ -423,7 +439,7 @@ pub async fn test_double_slash() {
423439 let repo_url = "https://github.com/lightningd/plugins.git" ;
424440 manager
425441 . coffee ( )
426- . add_remote ( repo_name, repo_url)
442+ . add_remote ( repo_name, repo_url, false )
427443 . await
428444 . unwrap ( ) ;
429445
@@ -486,7 +502,11 @@ pub async fn test_plugin_installation_path() {
486502 // Add lightningd remote repository
487503 manager
488504 . coffee ( )
489- . add_remote ( "lightningd" , "https://github.com/lightningd/plugins.git" )
505+ . add_remote (
506+ "lightningd" ,
507+ "https://github.com/lightningd/plugins.git" ,
508+ false ,
509+ )
490510 . await
491511 . unwrap ( ) ;
492512
@@ -604,7 +624,11 @@ pub async fn test_nurse_repository_missing_on_disk() {
604624 // Add folgore remote repository
605625 manager
606626 . coffee ( )
607- . add_remote ( "folgore" , "https://github.com/coffee-tools/folgore.git" )
627+ . add_remote (
628+ "folgore" ,
629+ "https://github.com/coffee-tools/folgore.git" ,
630+ false ,
631+ )
608632 . await
609633 . unwrap ( ) ;
610634
@@ -700,3 +724,87 @@ pub async fn test_nurse_repository_missing_on_disk() {
700724
701725 cln. stop ( ) . await . unwrap ( ) ;
702726}
727+
728+ /// Materializing the following test case
729+ /// https://github.com/coffee-tools/coffee/pull/239#issuecomment-2052606147
730+ #[ tokio:: test]
731+ #[ ntest:: timeout( 560000 ) ]
732+ pub async fn test_migrated_repository_to_local_one ( ) {
733+ init ( ) ;
734+ // We need to run before the testnet and the regtest
735+ // because we work on the same database
736+ //
737+ // WHEN UNIX socket?
738+ let dir = Arc :: new ( tempfile:: tempdir ( ) . unwrap ( ) ) ;
739+
740+ let testnet_conf = CoffeeTestingArgs {
741+ conf : None ,
742+ data_dir : dir. path ( ) . to_str ( ) . unwrap ( ) . to_owned ( ) ,
743+ network : "testnet" . to_owned ( ) ,
744+ } ;
745+
746+ let mut coffee_testnet_m = CoffeeTesting :: tmp_with_args ( & testnet_conf, dir. clone ( ) )
747+ . await
748+ . unwrap ( ) ;
749+ let coffee_testnet = coffee_testnet_m. coffee ( ) ;
750+ coffee_testnet
751+ . add_remote (
752+ "lightningd" ,
753+ "https://github.com/lightningd/plugins.git" ,
754+ false ,
755+ )
756+ . await
757+ . unwrap ( ) ;
758+
759+ let test_remotes = coffee_testnet. list_remotes ( ) . await . unwrap ( ) ;
760+ std:: mem:: drop ( coffee_testnet_m) ;
761+
762+ let regtest_conf = CoffeeTestingArgs {
763+ conf : None ,
764+ data_dir : dir. path ( ) . to_str ( ) . unwrap ( ) . to_owned ( ) ,
765+ network : "regtest" . to_owned ( ) ,
766+ } ;
767+
768+ let mut coffee_regtest_m = CoffeeTesting :: tmp_with_args ( & regtest_conf, dir. clone ( ) )
769+ . await
770+ . unwrap ( ) ;
771+ let coffee_regtest = coffee_regtest_m. coffee ( ) ;
772+
773+ coffee_regtest
774+ . add_remote (
775+ "folgore" ,
776+ "https://github.com/coffee-tools/folgore.git" ,
777+ false ,
778+ )
779+ . await
780+ . unwrap ( ) ;
781+
782+ coffee_regtest
783+ . install ( "folgore" , false , false )
784+ . await
785+ . unwrap ( ) ;
786+
787+ let reg_plugins = coffee_regtest. list ( ) . await . unwrap ( ) ;
788+ let reg_remotes = coffee_regtest. list_remotes ( ) . await . unwrap ( ) ;
789+
790+ std:: mem:: drop ( coffee_regtest_m) ;
791+ // just lightnind
792+ assert_eq ! ( test_remotes. remotes. unwrap( ) . len( ) , 1 ) ;
793+ // just folgore
794+ assert_eq ! ( reg_remotes. remotes. clone( ) . unwrap( ) . len( ) , 1 ) ;
795+
796+ let mut coffee_testnet_m = CoffeeTesting :: tmp_with_args ( & testnet_conf, dir. clone ( ) )
797+ . await
798+ . unwrap ( ) ;
799+ let coffee_testnet = coffee_testnet_m. coffee ( ) ;
800+ let test_plugins = coffee_testnet. list ( ) . await . unwrap ( ) ;
801+ let test_remotes = coffee_testnet. list_remotes ( ) . await . unwrap ( ) ;
802+ std:: mem:: drop ( coffee_testnet_m) ;
803+
804+ // in the regtest plugins we will just a single plugin, and in testnet none
805+ assert_eq ! ( test_plugins. plugins. len( ) + 1 , reg_plugins. plugins. len( ) ) ;
806+ assert_eq ! (
807+ test_remotes. remotes. unwrap( ) . len( ) ,
808+ reg_remotes. remotes. unwrap( ) . len( )
809+ ) ;
810+ }
0 commit comments