- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5
[TRUNK-14658] Add relative test file support #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
81ef3ab
              5b377e4
              7fde9e7
              9487cfb
              54ccca6
              729b3e9
              2cdff70
              d93a9d3
              b1f26fb
              44a2f0f
              c6f7617
              0f75674
              dfc3a94
              319212f
              9a92b82
              17fea27
              d86ee26
              b447410
              bae24ae
              e1c6bbb
              02b91f0
              ddc33bd
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -3,12 +3,12 @@ use superconsole::{ | |
| style::{style, Color, Stylize}, | ||
| Line, Span, | ||
| }; | ||
| use tempfile::tempdir; | ||
| use tempfile::{tempdir, TempDir}; | ||
|  | ||
| use crate::{ | ||
| command_builder::CommandBuilder, | ||
| utils::{ | ||
| generate_mock_codeowners, generate_mock_invalid_junit_xmls, | ||
| generate_mock_codeowners, generate_mock_git_repo, generate_mock_invalid_junit_xmls, | ||
| generate_mock_missing_filepath_suboptimal_junit_xmls, generate_mock_suboptimal_junit_xmls, | ||
| generate_mock_valid_junit_xmls, write_junit_xml_to_dir, | ||
| }, | ||
|  | @@ -170,7 +170,7 @@ fn validate_invalid_xml() { | |
|  | ||
| #[test] | ||
| fn validate_suboptimal_junits() { | ||
| let temp_dir = tempdir().unwrap(); | ||
| let temp_dir = TempDir::with_prefix("not-hidden").unwrap(); | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here, intentional? | ||
| generate_mock_suboptimal_junit_xmls(&temp_dir); | ||
|  | ||
| let assert = CommandBuilder::validate(temp_dir.path()) | ||
|  | @@ -196,6 +196,7 @@ fn validate_suboptimal_junits() { | |
| #[test] | ||
| fn validate_missing_filepath_suboptimal_junits() { | ||
| let temp_dir = tempdir().unwrap(); | ||
| generate_mock_git_repo(&temp_dir); | ||
| generate_mock_missing_filepath_suboptimal_junit_xmls(&temp_dir); | ||
| generate_mock_codeowners(&temp_dir); | ||
|  | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -166,6 +166,7 @@ impl From<TestCaseRun> for BindingsTestCase { | |
| attempt_number, | ||
| is_quarantined, | ||
| codeowners, | ||
| detected_file: _detected_file, | ||
| }: TestCaseRun, | ||
| ) -> Self { | ||
| let started_at = started_at.unwrap_or_default(); | ||
|  | @@ -1067,8 +1068,11 @@ mod tests { | |
| #[test] | ||
| fn parse_test_report_to_bindings() { | ||
| use prost_wkt_types::Timestamp; | ||
| use tempfile::TempDir; | ||
|  | ||
| use crate::junit::validator::validate; | ||
| use crate::{junit::validator::validate, repo::BundleRepo}; | ||
|  | ||
| let temp_dir = TempDir::with_prefix("not-hidden").unwrap(); | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. | ||
| let test_started_at = Timestamp { | ||
| seconds: 1000, | ||
| nanos: 0, | ||
|  | @@ -1080,11 +1084,13 @@ mod tests { | |
| let codeowner1 = CodeOwner { | ||
| name: "@user".into(), | ||
| }; | ||
| let test_file = temp_dir.path().join("test_file"); | ||
| let file_str = String::from(test_file.as_os_str().to_str().unwrap()); | ||
| let test1 = TestCaseRun { | ||
| id: "test_id1".into(), | ||
| name: "test_name".into(), | ||
| classname: "test_classname".into(), | ||
| file: "test_file".into(), | ||
| file: file_str.clone(), | ||
| parent_name: "test_parent_name1".into(), | ||
| line: 1, | ||
| status: TestCaseRunStatus::Success.into(), | ||
|  | @@ -1100,7 +1106,7 @@ mod tests { | |
| id: "test_id2".into(), | ||
| name: "test_name".into(), | ||
| classname: "test_classname".into(), | ||
| file: "test_file".into(), | ||
| file: file_str, | ||
| parent_name: "test_parent_name2".into(), | ||
| line: 1, | ||
| status: TestCaseRunStatus::Failure.into(), | ||
|  | @@ -1188,7 +1194,11 @@ mod tests { | |
| assert_eq!(test_case2.codeowners.clone().unwrap().len(), 0); | ||
|  | ||
| // verify that the test report is valid | ||
| let results = validate(&converted_bindings.clone().into(), None); | ||
| let results = validate( | ||
| &converted_bindings.clone().into(), | ||
| None, | ||
| &BundleRepo::default(), | ||
| ); | ||
| assert_eq!(results.all_issues_flat().len(), 1); | ||
| results | ||
| .all_issues_flat() | ||
|  | @@ -1224,6 +1234,8 @@ mod tests { | |
| #[cfg(feature = "bindings")] | ||
| #[test] | ||
| fn test_junit_conversion_paths() { | ||
| use crate::repo::BundleRepo; | ||
|  | ||
| let mut junit_parser = JunitParser::new(); | ||
| let file_contents = r#" | ||
| <xml version="1.0" encoding="UTF-8"?> | ||
|  | @@ -1242,7 +1254,7 @@ mod tests { | |
| assert!(parsed_results.is_ok()); | ||
|  | ||
| // Get test case runs from parser | ||
| let test_case_runs = junit_parser.into_test_case_runs(None); | ||
| let test_case_runs = junit_parser.into_test_case_runs(None, &BundleRepo::default()); | ||
| assert_eq!(test_case_runs.len(), 2); | ||
|  | ||
| // Convert test case runs to bindings | ||
|  | ||
Uh oh!
There was an error while loading. Please reload this page.