File tree 1 file changed +7
-11
lines changed
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use std::io::BufWriter;
12
12
use std:: path:: Path ;
13
13
use std:: path:: PathBuf ;
14
14
use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
15
- use tracing:: { error, info, warn } ;
15
+ use tracing:: { error, info} ;
16
16
17
17
/// A representation of the recording of activity of triagebot.
18
18
///
@@ -89,18 +89,14 @@ fn next_sequence() -> u32 {
89
89
/// `TRIAGEBOT_TEST_RECORD` environment variable is set.
90
90
pub fn init ( ) -> Result < ( ) > {
91
91
let Some ( record_dir) = record_dir ( ) else { return Ok ( ( ) ) } ;
92
+ if record_dir. exists ( ) && record_dir. read_dir ( ) ?. next ( ) . is_some ( ) {
93
+ panic ! (
94
+ "{record_dir:?} already exists.\n \
95
+ Delete the directory before recording if you wish to re-record that test."
96
+ ) ;
97
+ }
92
98
fs:: create_dir_all ( & record_dir)
93
99
. with_context ( || format ! ( "failed to create recording directory {record_dir:?}" ) ) ?;
94
- // Clear any old recording data.
95
- for entry in fs:: read_dir ( & record_dir) ? {
96
- let entry = entry?;
97
- let path = entry. path ( ) ;
98
- if path. extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "json" ) {
99
- warn ! ( "deleting old recording at {path:?}" ) ;
100
- fs:: remove_file ( & path)
101
- . with_context ( || format ! ( "failed to remove old recording {path:?}" ) ) ?;
102
- }
103
- }
104
100
Ok ( ( ) )
105
101
}
106
102
You can’t perform that action at this time.
0 commit comments