Skip to content

Commit 3e176e8

Browse files
committed
fix: remove ValidatedString and TestrunOrSkipped
I previously added these because we were having issues storing very long test names and I wanted to "validate" the data that came in to make sure that we're not including random strings for test names that might include source code. The main problem was that we weren't able to index that data in timescale and that was causing issues. I've since removed those indexes and if we have to index on names we'll have to use full text indexes next time, but for now we don't need this anymore. In the future, we'll likely have to add some mechanism for users to "ignore" irrelevant tests in the UI, or filter the names of tests. In any case, the scope of this library is to simply parse a JUnit XML file, so we should stick to that here, and avoid trying to do more.
1 parent accbb7f commit 3e176e8

19 files changed

+146
-268
lines changed

benches/binary.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rand::rngs::SmallRng;
66
use rand::seq::SliceRandom as _;
77
use rand::{Rng, SeedableRng};
88
use test_results_parser::binary::*;
9-
use test_results_parser::{Outcome, PropertiesValue, Testrun, ValidatedString};
9+
use test_results_parser::{Outcome, PropertiesValue, Testrun};
1010

1111
criterion_group!(benches, binary);
1212
criterion_main!(benches);
@@ -175,15 +175,15 @@ fn create_random_testcases(
175175
let name = Alphanumeric.sample_string(rng, name_len);
176176

177177
Testrun {
178-
name: name.try_into().unwrap(),
179-
classname: ValidatedString::default(),
178+
name: name,
179+
classname: String::new(),
180180
duration: Some(1.0),
181181
outcome: Outcome::Pass,
182-
testsuite: ValidatedString::default(),
182+
testsuite: String::new(),
183183
failure_message: None,
184184
filename: None,
185185
build_url: None,
186-
computed_name: ValidatedString::default(),
186+
computed_name: String::new(),
187187
properties: PropertiesValue(None),
188188
}
189189
})

src/binary/mod.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,21 @@ mod tests {
1818
use raw::CommitHash;
1919
use timestamps::DAY;
2020

21-
use crate::{
22-
testrun::{Outcome, PropertiesValue, Testrun},
23-
validated_string::ValidatedString,
24-
};
21+
use crate::testrun::{Outcome, PropertiesValue, Testrun};
2522

2623
use super::*;
2724

2825
fn test() -> Testrun {
2926
Testrun {
30-
name: "abc".try_into().unwrap(),
31-
classname: ValidatedString::default(),
27+
name: "abc".to_string(),
28+
classname: String::new(),
3229
duration: Some(1.0),
3330
outcome: Outcome::Pass,
34-
testsuite: ValidatedString::default(),
31+
testsuite: String::new(),
3532
failure_message: None,
3633
filename: None,
3734
build_url: None,
38-
computed_name: ValidatedString::default(),
35+
computed_name: String::new(),
3936
properties: PropertiesValue(None),
4037
}
4138
}
@@ -64,7 +61,7 @@ mod tests {
6461
test.duration = Some(2.0);
6562
session.insert(&test);
6663

67-
test.name = "def".try_into().unwrap();
64+
test.name = "def".into();
6865
test.outcome = Outcome::Skip;
6966
test.duration = Some(0.0);
7067
session.insert(&test);
@@ -98,7 +95,7 @@ mod tests {
9895
let mut session = writer.start_session(0, CommitHash::default(), &[]);
9996

10097
session.insert(&test);
101-
test.testsuite = "some testsuite".try_into().unwrap();
98+
test.testsuite = "some testsuite".into();
10299
session.insert(&test);
103100

104101
let mut buf = vec![];

0 commit comments

Comments
 (0)