-
Notifications
You must be signed in to change notification settings - Fork 347
[JENKINS-34217] add option to disable historical statistics gathering for test results #42
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /* | ||
| * The MIT License | ||
| * | ||
| * Copyright 2016 SAP SE | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| */ | ||
| package hudson.tasks.junit; | ||
|
|
||
| import hudson.Extension; | ||
| import hudson.model.Job; | ||
| import hudson.model.JobProperty; | ||
| import hudson.model.JobPropertyDescriptor; | ||
| import net.sf.json.JSONObject; | ||
| import org.kohsuke.stapler.StaplerRequest; | ||
|
|
||
| /** | ||
| * | ||
| */ | ||
| public class JobTestResultDisplayProperty extends JobProperty<Job<?, ?>> { | ||
| private final boolean disableHistoricalResults; | ||
|
|
||
| public JobTestResultDisplayProperty(Boolean disableHistoricalResults) { | ||
| if ( disableHistoricalResults != null ) { | ||
| this.disableHistoricalResults = disableHistoricalResults; | ||
| } | ||
| else { | ||
| this.disableHistoricalResults = false; | ||
| } | ||
| } | ||
|
|
||
| public boolean getDisableHistoricalResults() { | ||
| return disableHistoricalResults; | ||
| } | ||
|
|
||
| @Extension | ||
| public static class DescriptorImpl extends JobPropertyDescriptor { | ||
|
Member
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. Add |
||
|
|
||
| @Override | ||
| public String getDisplayName() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public JobTestResultDisplayProperty newInstance(StaplerRequest req, JSONObject formData) { | ||
|
Member
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. Why not just DataBoundConstructor? |
||
| if (formData.isNullObject()) return null; | ||
| return new JobTestResultDisplayProperty(formData.getBoolean("junitsettings-disableHistoricalResults")); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,6 +137,11 @@ public TestResult getPreviousResult() { | |
| if (b == null) { | ||
| return null; | ||
| } | ||
|
|
||
| // abort if the job is configured to not do this | ||
| AbstractTestResultAction tra = b.getAction(getParentAction().getClass()); | ||
| if ( tra != null && !tra.shouldCalculatePreviousResults()) return null; | ||
|
Member
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. brackets |
||
|
|
||
| while(true) { | ||
| b = b.getPreviousBuild(); | ||
| if(b==null) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <!-- | ||
| The MIT License | ||
|
|
||
| Copyright 2016 SAP AG | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. | ||
| --> | ||
| <?jelly escape-by-default='true'?> | ||
| <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" | ||
| xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
| <f:optionalBlock name="junitsettings-disableHistoricalResults" | ||
| title="${%Disable JUnit historical test results statistics}" | ||
| checked="${instance.disableHistoricalResults}" | ||
| inline="true" | ||
| help="/descriptor/hudson.tasks.junit.JobTestResultDisplayProperty/help/disableHistoricalResults" | ||
| /> | ||
| </j:jelly> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <!-- | ||
| The MIT License | ||
|
|
||
| Copyright 2016 SAP AG | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. | ||
| --> | ||
| <div> | ||
| If enabled, historical test results will not be computed and maintained for this job. | ||
| <br> | ||
| The test results graph will not be displayed, and the number of builds for which a test has been failing will not be computed. | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally there should be space-based indenting instead of tabs