File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ class AuditFile {
5353 // closing and then re-opening we can just keep open and
5454 // update the open_time.
5555 open_time = auditd_time ();
56- return true ;
56+ return false ;
5757 }
5858 close_and_rotate_log ();
5959 return true ;
Original file line number Diff line number Diff line change @@ -82,6 +82,28 @@ TEST_F(AuditFileTest, TestFileCreation) {
8282 EXPECT_EQ (1 , files.size ());
8383}
8484
85+ /* *
86+ * Test that an empty file is properly rotated using ensure_open()
87+ * Seen issues in the past such as MB-32232
88+ */
89+ TEST_F (AuditFileTest, TestRotateEmptyFile) {
90+ AuditConfig defaultvalue;
91+ config.set_rotate_interval (defaultvalue.get_min_file_rotation_time ());
92+ config.set_rotate_size (1024 *1024 );
93+
94+ AuditFile auditfile;
95+ auditfile.reconfigure (config);
96+
97+ auditfile.ensure_open ();
98+ cb_timeofday_timetravel (defaultvalue.get_min_file_rotation_time () + 1 );
99+ auditfile.ensure_open ();
100+
101+ auditfile.close ();
102+
103+ auto files = findFilesWithPrefix (testdir + " /testing" );
104+ EXPECT_EQ (0 , files.size ());
105+ }
106+
85107/* *
86108 * Test that we can create a file, and as time flies by we rotate
87109 * to use the next file
You can’t perform that action at this time.
0 commit comments