1
- use std:: { path:: PathBuf , process:: Command } ;
1
+ use std:: { collections :: HashMap , path:: PathBuf , process:: Command } ;
2
2
3
3
use dockertest:: {
4
4
waitfor:: { MessageSource , MessageWait } ,
@@ -8,25 +8,29 @@ use dockertest::{
8
8
#[ test]
9
9
fn e2e_test ( ) {
10
10
let mut test = DockerTest :: new ( ) . with_default_source ( Source :: DockerHub ) ;
11
+ let mut container_env = HashMap :: new ( ) ;
12
+ container_env. insert ( "initialBuckets" . to_string ( ) , "foo" . to_string ( ) ) ;
11
13
let mut aws = Composition :: with_repository ( "adobe/s3mock" )
12
14
. with_container_name ( "aws" )
13
15
. with_wait_for ( Box :: new ( MessageWait {
14
16
message : "Started S3MockApplication" . to_string ( ) ,
15
17
source : MessageSource :: Stdout ,
16
18
timeout : 10 ,
17
- } ) ) ;
18
- aws. port_map ( 9090 , 9090 ) ;
19
+ } ) )
20
+ . with_env ( container_env) ;
21
+ aws. port_map ( 9090 , 9090 ) . port_map ( 9191 , 9191 ) ;
19
22
test. add_composition ( aws) ;
20
23
21
24
test. run ( |ops| async move {
22
25
let _container = ops. handle ( "aws" ) ;
23
26
let path = PathBuf :: from ( env ! ( "CARGO_BIN_EXE_awsbck" ) ) ;
24
27
let output = Command :: new ( path)
28
+ . env ( "AWSBCK_TESTING_E2E" , "1" )
25
29
. args ( [ "-b" , "foo" , "--id" , "bar" , "-k" , "baz" ] )
26
30
. arg ( "./src" )
27
31
. output ( )
28
32
. expect ( "Failed to execute command" ) ;
29
- println ! ( "{}" , String :: from_utf8_lossy( & output. stderr) ) ;
30
33
assert ! ( output. status. success( ) ) ;
34
+ assert ! ( String :: from_utf8_lossy( & output. stderr) . contains( "Backup succeeded" ) ) ;
31
35
} ) ;
32
36
}
0 commit comments