1+ #[ cfg_attr( test, macro_use) ]
2+ extern crate lazy_static;
13extern crate serde;
24extern crate serde_json;
35extern crate serde_yaml;
4- extern crate tempdir;
5- #[ macro_use]
6- extern crate lazy_static;
7- #[ macro_use]
8- extern crate serde_derive;
6+ extern crate tempfile;
97
108#[ cfg( test) ]
119mod tests {
@@ -19,7 +17,8 @@ mod tests {
1917 use std:: io:: { Read , Write } ;
2018 use std:: path:: Path ;
2119 use std:: process:: Command ;
22- use tempdir:: TempDir ;
20+ use tempfile:: Builder ;
21+ use tempfile:: TempDir ;
2322 const SOPS_BINARY_PATH : & ' static str = "./sops" ;
2423 const KMS_KEY : & ' static str = "FUNCTIONAL_TEST_KMS_ARN" ;
2524
@@ -36,8 +35,10 @@ mod tests {
3635 }
3736
3837 lazy_static ! {
39- static ref TMP_DIR : TempDir =
40- TempDir :: new( "sops-functional-tests" ) . expect( "Unable to create temporary directory" ) ;
38+ static ref TMP_DIR : TempDir = Builder :: new( )
39+ . prefix( "sops-functional-tests" )
40+ . tempdir( )
41+ . expect( "Unable to create temporary directory" ) ;
4142 }
4243
4344 fn prepare_temp_file ( name : & str , contents : & [ u8 ] ) -> String {
@@ -806,7 +807,7 @@ b: ba"#
806807 let file_path = "res/comments.yaml" ;
807808 let output = Command :: new ( SOPS_BINARY_PATH )
808809 . arg ( "encrypt" )
809- . arg ( file_path. clone ( ) )
810+ . arg ( file_path)
810811 . output ( )
811812 . expect ( "Error running sops" ) ;
812813 assert ! ( output. status. success( ) , "SOPS didn't return successfully" ) ;
@@ -825,7 +826,7 @@ b: ba"#
825826 let file_path = "res/comments_list.yaml" ;
826827 let output = Command :: new ( SOPS_BINARY_PATH )
827828 . arg ( "encrypt" )
828- . arg ( file_path. clone ( ) )
829+ . arg ( file_path)
829830 . output ( )
830831 . expect ( "Error running sops" ) ;
831832 assert ! ( output. status. success( ) , "SOPS didn't return successfully" ) ;
@@ -844,7 +845,7 @@ b: ba"#
844845 let file_path = "res/comments.enc.yaml" ;
845846 let output = Command :: new ( SOPS_BINARY_PATH )
846847 . arg ( "decrypt" )
847- . arg ( file_path. clone ( ) )
848+ . arg ( file_path)
848849 . output ( )
849850 . expect ( "Error running sops" ) ;
850851 assert ! ( output. status. success( ) , "SOPS didn't return successfully" ) ;
@@ -863,7 +864,7 @@ b: ba"#
863864 let file_path = "res/comments_unencrypted_comments.yaml" ;
864865 let output = Command :: new ( SOPS_BINARY_PATH )
865866 . arg ( "decrypt" )
866- . arg ( file_path. clone ( ) )
867+ . arg ( file_path)
867868 . output ( )
868869 . expect ( "Error running sops" ) ;
869870 assert ! ( output. status. success( ) , "SOPS didn't return successfully" ) ;
0 commit comments