Commit 04dfdf1
authored
fix(test): de-flake TestCleanDeletesOldestFiles (#2446)
The test failed intermittently in CI with messages like
"Expect subA/file5.txt to match file(6|7|8)\.txt".
Root cause is a race between the scanner and the main loop. With
BatchN=4 and DeleteN=2, the scanner can pop a 5th candidate (e.g.
file6_A) before the main loop reinserts the "younger" half of the
previous batch (e.g. file7_A) back into the same subdir. The
reinserted file7_A then never gets popped again, while file6_A goes
on to be deleted in the next batch — producing a "gap" in the
deleted suffix that the regex assertion didn't allow for.
Set BatchN == DeleteN so splitBatch reinserts nothing, eliminating
the cross-batch race. Replace the brittle filename regex with the
real algorithmic invariant the cleaner now guarantees: per subdir
the deleted indices form a contiguous suffix [N..8].
splitBatch's reinsert behavior is still covered by TestSplitBatch.1 parent 06a6402 commit 04dfdf1
1 file changed
Lines changed: 36 additions & 15 deletions
Lines changed: 36 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | | - | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
101 | | - | |
102 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
107 | | - | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | | - | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
114 | | - | |
115 | | - | |
| 120 | + | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
120 | | - | |
121 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
122 | 130 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
128 | 149 | | |
129 | 150 | | |
130 | 151 | | |
| |||
0 commit comments