File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ extern crate cargotest;
2
2
extern crate hamcrest;
3
3
4
4
use cargotest:: ChannelChanger ;
5
- use cargotest:: support:: registry:: { self , Package } ;
5
+ use cargotest:: support:: registry:: { self , Package , alt_dl_path } ;
6
6
use cargotest:: support:: { project, execs} ;
7
7
use hamcrest:: assert_that;
8
8
@@ -308,4 +308,7 @@ fn publish_to_alt_registry() {
308
308
assert_that ( p. cargo ( "publish" ) . masquerade_as_nightly_cargo ( )
309
309
. arg ( "--registry" ) . arg ( "alternative" ) . arg ( "-Zunstable-options" ) ,
310
310
execs ( ) . with_status ( 0 ) ) ;
311
+
312
+ // Ensure that the crate is uploaded
313
+ assert ! ( alt_dl_path( ) . join( "api/v1/crates/new" ) . exists( ) ) ;
311
314
}
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ pub fn dl_path() -> PathBuf { paths::root().join("dl") }
20
20
pub fn dl_url ( ) -> Url { Url :: from_file_path ( & * dl_path ( ) ) . ok ( ) . unwrap ( ) }
21
21
pub fn alt_registry_path ( ) -> PathBuf { paths:: root ( ) . join ( "alternative-registry" ) }
22
22
pub fn alt_registry ( ) -> Url { Url :: from_file_path ( & * alt_registry_path ( ) ) . ok ( ) . unwrap ( ) }
23
+ pub fn alt_dl_path ( ) -> PathBuf { paths:: root ( ) . join ( "alt_dl" ) }
24
+ pub fn alt_dl_url ( ) -> Url { Url :: from_file_path ( & * alt_dl_path ( ) ) . ok ( ) . unwrap ( ) }
23
25
24
26
pub struct Package {
25
27
name : String ,
@@ -75,9 +77,9 @@ pub fn init() {
75
77
repo ( & alt_registry_path ( ) )
76
78
. file ( "config.json" , & format ! ( r#"
77
79
{{"dl":"{0}","api":"{0}"}}
78
- "# , dl_url ( ) ) )
80
+ "# , alt_dl_url ( ) ) )
79
81
. build ( ) ;
80
- fs:: create_dir_all ( dl_path ( ) . join ( "api/v1/crates" ) ) . unwrap ( ) ;
82
+ fs:: create_dir_all ( alt_dl_path ( ) . join ( "api/v1/crates" ) ) . unwrap ( ) ;
81
83
}
82
84
83
85
impl Package {
@@ -299,7 +301,8 @@ impl Package {
299
301
registry_path ( ) . join ( format ! ( "{}-{}.crate" , self . name,
300
302
self . vers) )
301
303
} else {
302
- dl_path ( ) . join ( & self . name ) . join ( & self . vers ) . join ( "download" )
304
+ let dl_path = if self . alternative { alt_dl_path ( ) } else { dl_path ( ) } ;
305
+ dl_path. join ( & self . name ) . join ( & self . vers ) . join ( "download" )
303
306
}
304
307
}
305
308
}
You can’t perform that action at this time.
0 commit comments