|
| 1 | +// Copyright 2024 FastLabs Developers |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
1 | 15 | //! Ensure max_log_files limits the total number of log files across multiple date patterns. |
2 | 16 |
|
3 | | -use logforth_append_file::FileBuilder; |
4 | | -use logforth_core::Append; |
5 | | -use logforth_core::record::Record; |
6 | 17 | use std::fs; |
7 | 18 | use std::num::NonZeroUsize; |
8 | 19 | use std::path::Path; |
9 | 20 | use std::thread; |
10 | 21 | use std::time::Duration; |
| 22 | + |
| 23 | +use logforth_append_file::FileBuilder; |
| 24 | +use logforth_core::Append; |
| 25 | +use logforth_core::record::Record; |
11 | 26 | use tempfile::TempDir; |
12 | 27 |
|
13 | 28 | #[test] |
@@ -77,7 +92,8 @@ fn test_file_limit_across_multiple_dates() { |
77 | 92 | let max_files = 10; // Set maximum file count to 10 |
78 | 93 | let max_size = 50; // Small file size to trigger rotation quickly |
79 | 94 |
|
80 | | - // Create multiple log writers, each with a different filename pattern (simulating different dates) |
| 95 | + // Create multiple log writers, each with a different filename pattern (simulating different |
| 96 | + // dates) |
81 | 97 | println!("Creating multiple log files with different date patterns"); |
82 | 98 |
|
83 | 99 | // First batch - simulate March 18 |
@@ -114,7 +130,8 @@ fn test_file_limit_across_multiple_dates() { |
114 | 130 | println!("Files: {:?}", files); |
115 | 131 |
|
116 | 132 | // Verify if the total number of files exceeds the limit |
117 | | - // Note: If this assertion fails, it means we've reproduced the issue - file count is not properly limited |
| 133 | + // Note: If this assertion fails, it means we've reproduced the issue - file count is not |
| 134 | + // properly limited |
118 | 135 | assert!( |
119 | 136 | files.len() <= max_files, |
120 | 137 | "Expected at most {} files, but found {} files across multiple dates", |
|
0 commit comments