-
-
Notifications
You must be signed in to change notification settings - Fork 9k
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 JENKINS-43848] - Lack of cache-invalidation headers results in stale item list #2973
Conversation
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
There's some sort of whack white-space issue. Those are not showing up in my local diff. My Git settings are checkin with Unix line-feeds, checkout with local OS. |
@josiahhaswell Which IDE you use just in case? |
@josiahhaswell It's not line endings, your IDE reformats empty (whitespace only) lines. |
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.
Although whitespace fixes are correct, they should not be fixed in the bugfix since they complicate backporting. Likely you use IDEA and hence need to configure it to be less smart :(
Also side note: if you use format: [FIX JENKINS-######] in the title, the issue tracker will automatically update things for you nicely |
@kzantow Yes, you are right. But we can always fix it by squash :) |
Ok. I had a version of IntelliJ with a bug wherein it would remove trailing whitespace no matter what was selected. Upgraded and fixed. |
String resp = values.get("Cache-Control"); | ||
assertThat(resp, is("no cache, no store, must revalidate")); | ||
assertThat(values.get("Expires"), is("0")); | ||
assertThat(values.get("Pragma"), is("no-cache")); |
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.
FWIW easier to write:
WebResponse rsp = j.createWebClient().goTo("view/all/itemCategories", "application/json").getWebResponse();
assertEquals("no cache, no store, must revalidate", rsp.getResponseHeaderValue("Cache-Control"));
assertEquals("0", rsp.getResponseHeaderValue("Expires"));
assertEquals("no cache", rsp.getResponseHeaderValue("Pragma"));
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.
🐝 and @reviewbybees done
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.
Opps, test needs to be fixed, hence 🐛
Error
Expected: is "no cache, no store, must revalidate"
but: was "no-cache, no-store, must-revalidate"
Stacktrace
java.lang.AssertionError:
Expected: is "no cache, no store, must revalidate"
but: was "no-cache, no-store, must-revalidate"
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.junit.Assert.assertThat(Assert.java:956)
at org.junit.Assert.assertThat(Assert.java:923)
at hudson.model.ViewTest.testNoCacheHeadersAreSet(ViewTest.java:108)
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:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.jvnet.hudson.test.JenkinsRule$2.evaluate(JenkinsRule.java:547)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)
Standard Output
=== Starting testNoCacheHeadersAreSet(hudson.model.ViewTest)
Standard Error
Aug 08, 2017 7:59:09 PM org.jvnet.hudson.test.JenkinsRule createWebServer
INFO: Running on http://localhost:41088/jenkins/
Aug 08, 2017 7:59:09 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Aug 08, 2017 7:59:09 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Aug 08, 2017 7:59:09 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Aug 08, 2017 7:59:09 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Aug 08, 2017 7:59:09 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Aug 08, 2017 7:59:10 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Aug 08, 2017 7:59:10 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Aug 08, 2017 7:59:10 PM jenkins.model.Jenkins cleanUp
INFO: Stopping Jenkins
Aug 08, 2017 7:59:11 PM jenkins.model.Jenkins cleanUp
INFO: Jenkins stopped
See JENKINS-43848.
Proposed changelog entries
Submitter checklist
* Use the
Internal:
prefix if the change has no user-visible impact (API, test frameworks, etc.)Desired reviewers
@mention
@reviewbybees