@@ -50,6 +50,10 @@ pub struct S3Config {
50
50
}
51
51
52
52
impl StorageConfig {
53
+ pub fn in_memory ( ) -> Self {
54
+ Self :: InMemory
55
+ }
56
+
53
57
pub fn from_environment ( ) -> Self {
54
58
if let Ok ( bucket) = dotenvy:: var ( "S3_BUCKET" ) {
55
59
let region = dotenvy:: var ( "S3_REGION" ) . ok ( ) ;
@@ -339,7 +343,7 @@ mod tests {
339
343
use tempfile:: NamedTempFile ;
340
344
341
345
pub async fn prepare ( ) -> Storage {
342
- let storage = Storage :: from_config ( & StorageConfig :: InMemory ) ;
346
+ let storage = Storage :: from_config ( & StorageConfig :: in_memory ( ) ) ;
343
347
344
348
let files_to_create = vec ! [
345
349
"crates/bar/bar-2.0.0.crate" ,
@@ -367,7 +371,7 @@ mod tests {
367
371
368
372
#[ test]
369
373
fn locations ( ) {
370
- let storage = Storage :: from_config ( & StorageConfig :: InMemory ) ;
374
+ let storage = Storage :: from_config ( & StorageConfig :: in_memory ( ) ) ;
371
375
372
376
let crate_tests = vec ! [
373
377
( "foo" , "1.2.3" , "/crates/foo/foo-1.2.3.crate" ) ,
@@ -458,7 +462,7 @@ mod tests {
458
462
459
463
#[ tokio:: test]
460
464
async fn upload_crate_file ( ) {
461
- let s = Storage :: from_config ( & StorageConfig :: InMemory ) ;
465
+ let s = Storage :: from_config ( & StorageConfig :: in_memory ( ) ) ;
462
466
463
467
s. upload_crate_file ( "foo" , "1.2.3" , Bytes :: new ( ) )
464
468
. await
@@ -480,7 +484,7 @@ mod tests {
480
484
481
485
#[ tokio:: test]
482
486
async fn upload_readme ( ) {
483
- let s = Storage :: from_config ( & StorageConfig :: InMemory ) ;
487
+ let s = Storage :: from_config ( & StorageConfig :: in_memory ( ) ) ;
484
488
485
489
let bytes = Bytes :: from_static ( b"hello world" ) ;
486
490
s. upload_readme ( "foo" , "1.2.3" , bytes. clone ( ) )
@@ -501,7 +505,7 @@ mod tests {
501
505
502
506
#[ tokio:: test]
503
507
async fn sync_index ( ) {
504
- let s = Storage :: from_config ( & StorageConfig :: InMemory ) ;
508
+ let s = Storage :: from_config ( & StorageConfig :: in_memory ( ) ) ;
505
509
506
510
assert ! ( stored_files( & s. store) . await . is_empty( ) ) ;
507
511
@@ -518,7 +522,7 @@ mod tests {
518
522
519
523
#[ tokio:: test]
520
524
async fn upload_db_dump ( ) {
521
- let s = Storage :: from_config ( & StorageConfig :: InMemory ) ;
525
+ let s = Storage :: from_config ( & StorageConfig :: in_memory ( ) ) ;
522
526
523
527
assert ! ( stored_files( & s. store) . await . is_empty( ) ) ;
524
528
0 commit comments