Commit 1c5f71a
authored
fix: include filename in JUnit XML parse errors and consolidate directory walk (#895)
* green: ingestJunitDir error includes filename when XML parsing fails
Replace junit.IngestDir() with our own filepath.Walk that calls
junit.IngestFile() per file and wraps errors with the filename.
This makes XML parsing errors actionable — users can now see which
file caused the failure.
Add test fixture with ISO-8859-15 encoding declaration and three
unit tests for ingestJunitDir: filename in error, no-tests-found,
and valid JUnit parsing.
Refs #894
* green: getJunitFilenames error includes filename when XML parsing fails
Same wrapping treatment as ingestJunitDir — wrap junit.IngestFile()
errors with the filename so users can identify which file caused
the failure.
Refs #894
* green: consolidate JUnit dir walk into single pass
ingestJunitDir now returns both parsed results and the list of
JUnit filenames (for upload), eliminating the separate
getJunitFilenames() function and its redundant directory walk.
Refs #894
* refactor: address review feedback
- Return nil instead of empty slice on Walk error for consistency
- Merge TestIngestJunitDir_ReturnsFilenames into TestIngestJunitDir
Refs #894
* green: user-friendly error message for unsupported XML encoding
Replace the cryptic Go stdlib error (Decoder.CharsetReader is nil)
with an actionable message that tells the user which file failed,
that only UTF-8 is supported, and to use --results-dir if the file
is not a JUnit results file.
Refs #894
* refactor: address second round of review feedback
- Use filepath.WalkDir instead of filepath.Walk (avoids os.Lstat per entry)
- Return nil, nil on all error paths for consistency
- Assert exact filename count in test
Refs #894
* fix: alphabetical import ordering
Refs #8941 parent 66718f9 commit 1c5f71a
3 files changed
Lines changed: 73 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
164 | | - | |
| 165 | + | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | 172 | | |
176 | 173 | | |
177 | 174 | | |
| |||
212 | 209 | | |
213 | 210 | | |
214 | 211 | | |
215 | | - | |
| 212 | + | |
216 | 213 | | |
217 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
218 | 237 | | |
219 | | - | |
| 238 | + | |
220 | 239 | | |
221 | 240 | | |
222 | | - | |
223 | | - | |
| 241 | + | |
| 242 | + | |
224 | 243 | | |
225 | 244 | | |
226 | | - | |
| 245 | + | |
227 | 246 | | |
228 | 247 | | |
229 | 248 | | |
230 | | - | |
| 249 | + | |
231 | 250 | | |
232 | 251 | | |
233 | 252 | | |
| |||
244 | 263 | | |
245 | 264 | | |
246 | 265 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 266 | + | |
277 | 267 | | |
278 | 268 | | |
279 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments