@@ -40,7 +40,11 @@ pub async fn init_coffee_test_cmd() -> anyhow::Result<()> {
40
40
let root_path = manager. root_path ( ) . to_owned ( ) ;
41
41
manager
42
42
. 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
+ )
44
48
. await
45
49
. unwrap ( ) ;
46
50
@@ -107,7 +111,11 @@ pub async fn init_coffee_test_add_remote() {
107
111
108
112
manager
109
113
. 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
+ )
111
119
. await
112
120
. unwrap ( ) ;
113
121
manager
@@ -141,7 +149,7 @@ pub async fn test_add_remove_plugins() {
141
149
let repo_url = "https://github.com/lightningd/plugins.git" ;
142
150
manager
143
151
. coffee ( )
144
- . add_remote ( repo_name, repo_url)
152
+ . add_remote ( repo_name, repo_url, false )
145
153
. await
146
154
. unwrap ( ) ;
147
155
@@ -260,7 +268,7 @@ pub async fn test_errors_and_show() {
260
268
let repo_url = "https://github.com/lightningd/plugins.git" ;
261
269
manager
262
270
. coffee ( )
263
- . add_remote ( repo_name, repo_url)
271
+ . add_remote ( repo_name, repo_url, false )
264
272
. await
265
273
. unwrap ( ) ;
266
274
@@ -346,7 +354,11 @@ pub async fn install_plugin_in_two_networks() -> anyhow::Result<()> {
346
354
// Add lightningd remote repository
347
355
manager
348
356
. 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
+ )
350
362
. await
351
363
. unwrap ( ) ;
352
364
// Install summary plugin
@@ -386,7 +398,11 @@ pub async fn install_plugin_in_two_networks() -> anyhow::Result<()> {
386
398
387
399
let result = manager
388
400
. 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
+ )
390
406
. await ;
391
407
assert ! ( result. is_err( ) , "{:?}" , result) ;
392
408
// Install summary plugin
@@ -423,7 +439,7 @@ pub async fn test_double_slash() {
423
439
let repo_url = "https://github.com/lightningd/plugins.git" ;
424
440
manager
425
441
. coffee ( )
426
- . add_remote ( repo_name, repo_url)
442
+ . add_remote ( repo_name, repo_url, false )
427
443
. await
428
444
. unwrap ( ) ;
429
445
@@ -486,7 +502,11 @@ pub async fn test_plugin_installation_path() {
486
502
// Add lightningd remote repository
487
503
manager
488
504
. 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
+ )
490
510
. await
491
511
. unwrap ( ) ;
492
512
@@ -604,7 +624,11 @@ pub async fn test_nurse_repository_missing_on_disk() {
604
624
// Add folgore remote repository
605
625
manager
606
626
. 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
+ )
608
632
. await
609
633
. unwrap ( ) ;
610
634
@@ -700,3 +724,87 @@ pub async fn test_nurse_repository_missing_on_disk() {
700
724
701
725
cln. stop ( ) . await . unwrap ( ) ;
702
726
}
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