diff mbox

Include branch name in test results sent to Patchwork

Message ID 1461142583-12049-1-git-send-email-andrew.donnellan@au1.ibm.com
State Accepted
Delegated to: Russell Currey
Headers show

Commit Message

Andrew Donnellan April 20, 2016, 8:56 a.m. UTC
If a project is configured to test on multiple branches and a patch applies
to more than one base branch, only one result for each Jenkins job will
appear in Patchwork since the test name is the same.

Reformat the Patchwork test names to be of the format "branch/test_name" so
we can distinguish between different base branches.

Closes: #25 ("Test names sent to Patchwork need to differ per branch")
Reported-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
 src/main.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Russell Currey May 3, 2016, 4:28 a.m. UTC | #1
On Wed, 2016-04-20 at 18:56 +1000, Andrew Donnellan wrote:
> If a project is configured to test on multiple branches and a patch applies
> to more than one base branch, only one result for each Jenkins job will
> appear in Patchwork since the test name is the same.
> 
> Reformat the Patchwork test names to be of the format "branch/test_name" so
> we can distinguish between different base branches.
> 
> Closes: #25 ("Test names sent to Patchwork need to differ per branch")
> Reported-by: Russell Currey <ruscur@russell.cc>
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---

Merged to master as of 22cba0632c77e55e75815756cff944fda6bd0b6c, thanks.
diff mbox

Patch

diff --git a/src/main.rs b/src/main.rs
index d0177af..e9c2035 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,7 +79,7 @@  struct Args {
     flag_project: String,
 }
 
-fn run_tests(settings: &Config, project: &Project, tag: &str) -> Vec<TestResult> {
+fn run_tests(settings: &Config, project: &Project, tag: &str, branch_name: &str) -> Vec<TestResult> {
     let mut results: Vec<TestResult> = Vec::new();
     let jenkins = JenkinsBackend { base_url: &settings.jenkins.url };
     let project = project.clone();
@@ -112,7 +112,7 @@  fn run_tests(settings: &Config, project: &Project, tag: &str) -> Vec<TestResult>
         jenkins.wait_build(&build_url_real);
         println!("Job done!");
         results.push(TestResult {
-            test_name: job_name.to_string(),
+            test_name: format!("{}/{}", branch_name.to_string(), job_name.to_string()),
             state: TestState::SUCCESS.string(), // TODO: get this from Jenkins
             url: None, // TODO: link to Jenkins job log
             summary: Some("TODO: get this summary from Jenkins".to_string()),
@@ -201,7 +201,7 @@  fn test_patch(settings: &Config, project: &Project, path: &Path) -> Vec<TestResu
 
         // We've set up a remote branch, time to kick off tests
         let test = thread::Builder::new().name(tag.to_string()).spawn(move || {
-            return run_tests(&settings_clone, &project, &tag);
+            return run_tests(&settings_clone, &project, &tag, &branch_name);
         }).unwrap();
         results.append(&mut test.join().unwrap());