Skip to content

Commit e0f8450

Browse files
authored
Add support for parsing Internal type (#486)
Addresses a long standing bug where we assume everything is junitxml. We also need this distinction for RSpec quarantining. Closes TRUNK-14012
1 parent e804f10 commit e0f8450

File tree

3 files changed

+249
-12
lines changed

3 files changed

+249
-12
lines changed

bundle/src/files.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,24 @@ impl FileSetBuilder {
4242
let file_set_builder =
4343
Self::file_sets_from_glob(repo_root, junit_paths, team, codeowners, exec_start)?;
4444

45-
// Handle case when junit paths are not globs.
45+
// Handle case when paths are not globs.
4646
if file_set_builder.count == 0 {
4747
let junit_paths_with_glob = junit_paths
4848
.iter()
4949
.cloned()
50-
.map(|mut junit_wrapper| {
51-
junit_wrapper.junit_path = PathBuf::from(junit_wrapper.junit_path)
50+
.flat_map(|junit_wrapper| {
51+
let mut junit_wrapper_xml = junit_wrapper.clone();
52+
junit_wrapper_xml.junit_path = PathBuf::from(junit_wrapper_xml.junit_path)
5253
.join("**/*.xml")
5354
.to_string_lossy()
5455
.to_string();
55-
junit_wrapper
56+
let mut junit_wrapper_internal = junit_wrapper.clone();
57+
junit_wrapper_internal.junit_path =
58+
PathBuf::from(junit_wrapper_internal.junit_path)
59+
.join("**/*.bin")
60+
.to_string_lossy()
61+
.to_string();
62+
vec![junit_wrapper_xml, junit_wrapper_internal]
5663
})
5764
.collect::<Vec<_>>();
5865

@@ -101,11 +108,22 @@ impl FileSetBuilder {
101108
Ok(acc)
102109
},
103110
)?;
111+
// If any file is a binary file, set the file set type to internal.
112+
let file_set_type = bundled_files.iter().fold(FileSetType::Junit, |acc, file| {
113+
if acc == FileSetType::Internal {
114+
return acc;
115+
}
116+
if file.original_path.ends_with(".bin") {
117+
return FileSetType::Internal;
118+
}
119+
acc
120+
});
104121
acc.count = count;
105122
acc.file_sets.push(FileSet::new(
106123
bundled_files,
107124
junit_wrapper.junit_path.clone(),
108125
junit_wrapper.status.clone(),
126+
file_set_type,
109127
));
110128
Ok(acc)
111129
},
@@ -167,9 +185,10 @@ impl FileSet {
167185
files: Vec<BundledFile>,
168186
glob: String,
169187
resolved_status: Option<JunitReportStatus>,
188+
file_set_type: FileSetType,
170189
) -> Self {
171190
Self {
172-
file_set_type: FileSetType::Junit,
191+
file_set_type,
173192
files,
174193
glob,
175194
resolved_status,
@@ -183,6 +202,7 @@ impl FileSet {
183202
pub enum FileSetType {
184203
#[default]
185204
Junit,
205+
Internal,
186206
}
187207

188208
#[cfg(feature = "wasm")]

0 commit comments

Comments
 (0)