Skip to content
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

Fix PCT failures #199

Merged
merged 7 commits into from
Jul 8, 2020
Merged

Conversation

chriskilding
Copy link
Contributor

@chriskilding chriskilding commented Jun 30, 2020

Fix the PCT failures unearthed in jenkinsci/bom#179

To do:

  • Update test code
  • Test the fixes with PCT locally

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right code to patch at least.

@jglick
Copy link
Member

jglick commented Jul 1, 2020

Thanks, looking close.

@chriskilding
Copy link
Contributor Author

I think I've got the lot now, although the build is still sensitive to timeouts.

How would I test this locally with PCT?

@jglick
Copy link
Member

jglick commented Jul 1, 2020

How would I test this locally with PCT?

https://github.com/jenkinsci/plugin-compat-tester#configuration there is an option to specify a local directory to use for the plugin sources, rather than checking out a tag.

If you happen to know the specific extensions causing the failures, it may be easier to just add that other plugin to the test classpath.

@chriskilding
Copy link
Contributor Author

I've run PCT against this with the following arguments:

docker run --rm -v maven-repo:/root/.m2 -v $(pwd)/out:/pct/out -e CHECKOUT_SRC=https://github.com/chriskilding/branch-api-plugin.git -e VERSION=fix-pct-failures jenkins/pct

The tests this was meant to fix seem to be fixed.

A couple of unrelated tests in branch-api failed, but I think it could just be some encoding issue running in the Docker PCT harness. Log below:

[ERROR] jenkins.branch.WorkspaceLocatorImplTest.deleteOffline  Time elapsed: 5.664 s  <<< ERROR!
hudson.model.Failure: ‘$’ is an unsafe character
	at jenkins.model.Jenkins.checkGoodName(Jenkins.java:4031)
	at hudson.model.ItemGroupMixIn.createProject(ItemGroupMixIn.java:316)
	at jenkins.model.Jenkins.createProject(Jenkins.java:3002)
	at jenkins.model.Jenkins.createProject(Jenkins.java:2998)
	at jenkins.model.Jenkins.createProject(Jenkins.java:3033)
	at org.jvnet.hudson.test.JenkinsRule.createProject(JenkinsRule.java:839)
	at org.jvnet.hudson.test.JenkinsRule.createFreeStyleProject(JenkinsRule.java:856)
	at jenkins.branch.WorkspaceLocatorImplTest.deleteOffline(WorkspaceLocatorImplTest.java:218)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:594)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

[ERROR] jenkins.branch.WorkspaceLocatorImplTest.locate  Time elapsed: 2.927 s  <<< ERROR!
hudson.model.Failure: ‘%’ is an unsafe character
	at jenkins.model.Jenkins.checkGoodName(Jenkins.java:4031)
	at hudson.model.ItemGroupMixIn.createProject(ItemGroupMixIn.java:316)
	at jenkins.model.Jenkins.createProject(Jenkins.java:3002)
	at jenkins.model.Jenkins.createProject(Jenkins.java:2998)
	at jenkins.model.Jenkins.createProject(Jenkins.java:3033)
	at org.jvnet.hudson.test.JenkinsRule.createProject(JenkinsRule.java:839)
	at org.jvnet.hudson.test.JenkinsRule.createFreeStyleProject(JenkinsRule.java:856)
	at jenkins.branch.WorkspaceLocatorImplTest.locate(WorkspaceLocatorImplTest.java:159)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:594)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

[ERROR] jenkins.branch.WorkspaceLocatorImplTest.uniquification  Time elapsed: 0.406 s  <<< ERROR!
hudson.model.Failure: ‘$’ is an unsafe character
	at jenkins.model.Jenkins.checkGoodName(Jenkins.java:4031)
	at hudson.model.ItemGroupMixIn.createProject(ItemGroupMixIn.java:316)
	at jenkins.model.Jenkins.createProject(Jenkins.java:3002)
	at jenkins.model.Jenkins.createProject(Jenkins.java:2998)
	at jenkins.model.Jenkins.createProject(Jenkins.java:3033)
	at org.jvnet.hudson.test.JenkinsRule.createProject(JenkinsRule.java:839)
	at org.jvnet.hudson.test.JenkinsRule.createFreeStyleProject(JenkinsRule.java:856)
	at jenkins.branch.WorkspaceLocatorImplTest.uniquification(WorkspaceLocatorImplTest.java:236)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:594)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

@chriskilding chriskilding marked this pull request as ready for review July 2, 2020 11:00
@jglick
Copy link
Member

jglick commented Jul 2, 2020

Not sure about the WorkspaceLocatorImplTest failures.

EventsTest timeout here smells like a flake.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still weakening existing tests a bit, but close.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for me, assuming you retest in PCT.

@chriskilding
Copy link
Contributor Author

chriskilding commented Jul 3, 2020

Retested. I've since found 2 more tests that had also failed in the pipeline-model-definition fork of BOM (https://ci.jenkins.io/blue/organizations/jenkins/Tools%2Fbom/detail/PR-179/27/pipeline/#step-6960-log-1332), which I had overlooked. They have no error message:

  • integration.EventsTest.given_multibranch_when_oneEventBlocking_then_otherEventsProcessed
  • jenkins.branch.CustomOrganizationFolderDescriptorTest.dynamicLoad2

There's also the 3 tests with "Failure ‘$’ is an unsafe character" errors not mentioned in the PMD run, and probably just caused by the harness:

  • jenkins.branch.WorkspaceLocatorImplTest.deleteOffline
  • jenkins.branch.WorkspaceLocatorImplTest.locate
  • jenkins.branch.WorkspaceLocatorImplTest.uniquification

@chriskilding
Copy link
Contributor Author

If I run dynamicLoad2 in my IDE, without PCT, I see the assumption assumeThat(CustomOrganizationFolderDescriptor.SHOW_GENERIC, is(true)); fails and the test is ignored.

Is Surefire treating an assumption failure (which should produce an ignored test) as a full test failure in the PCT harness?

@jglick
Copy link
Member

jglick commented Jul 6, 2020

Is Surefire treating an assumption failure (which should produce an ignored test) as a full test failure in the PCT harness?

Should not. Anyway I checked https://ci.jenkins.io/job/Tools/job/bom/job/PR-179/27/testReport/ and do not see any failures listed from what you mention in #199 (comment): they are all either passed or skipped.

@jglick
Copy link
Member

jglick commented Jul 6, 2020

tests that had also failed in PMD's run

Is there a reference? What is “PMD” in this context?

@chriskilding
Copy link
Contributor Author

PMD was the pipeline-model-definition fork of BOM. Don't know why I abbreviated it 🤦

I was thinking of the same test report as you, but as you've pointed out, while the two tests appeared in the build log as failures (https://ci.jenkins.io/blue/organizations/jenkins/Tools%2Fbom/detail/PR-179/27/pipeline/#step-6960-log-1332) they didn't appear as failures in the test report. If we're going by the test report tab then we can say they're not a problem.

@jglick
Copy link
Member

jglick commented Jul 7, 2020

Well Surefire first prints

[WARNING] Tests run: 80, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 120.09 s - in integration.EventsTest

then later

lists it under

Failed: 11
- integration.EventsTest.given_multibranch_when_oneEventBlocking_then_otherEventsProcessed
…

but I guess that is just a buglet in Surefire display.

@dwnusbaum dwnusbaum requested review from dwnusbaum and bitwiseman July 7, 2020 13:14
@bitwiseman
Copy link
Contributor

bitwiseman commented Jul 7, 2020

There's also the 3 tests with "Failure ‘$’ is an unsafe character" errors not mentioned in the PMD run, and probably just caused by the harness:

...

Each of these looks like test failures due to this change: jenkinsci/jenkins@f176292

@jglick
Copy link
Member

jglick commented Jul 8, 2020

jenkinsci/jenkins#4684 for the better link/backlink. Those issues look distinct. For whatever reason they are not currently failing in bom PCT, though it would be good to deal with them as well (perhaps in another PR). Probably only test failures, not production regressions, since the test is just trying to simulate MultiBranchProject children with funny names which in reality would go through a different code path.

@jglick
Copy link
Member

jglick commented Jul 8, 2020

For whatever reason

…because this patch is not in 2.235, only 2.237 and proposed for 2.235.2. I will look at fixing but this would be in a separate PR, not needed immediately.

Copy link
Member

@dwnusbaum dwnusbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, will trigger a rebuild now that #200 has been merged.

@@ -212,4 +212,4 @@ public String getDisplayName() {
return names;
}

}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to avoid unnecessary formatting changes.

Suggested change
}
}

import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

public class Extracting<Element, Property> extends TypeSafeDiagnosingMatcher<Iterable<Element>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would prefer to not add a utility like this to this specific plugin. I have wanted something like this occasionally though; perhaps it could be added to jenkins-test-harness.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants