Hi,
today I’ve discovered that WMS 1.3 cascading got broken in GeoServer as a result of Jody’s patch relative to GEOT-4283.
Basically GeoServer relied on some higher level checks for WMS 1.3, while Jody did similar checks and patches right inside the WMS classes.
What happens is, the two flipping logics trigger at the same time and they flip the axis twice… you may imagine the results.
Now, I did add some tests back in GeoTools, but they did not trigger Jody’s flipping logic due to a CRS setting, so the change broke GeoServer without anybody noticing.
Now, I’m working on stripping out the code that GeoServer relied onto, Jody’s approach is cleaner, but I also want to add some end to end tests so that we are not going to get bitten by this anymore.
Doing such kind of test requires to have some test server though, which can be obtained:
a) by using a fixed remote server
b) by standing up a local server during the test
c) by creating a WMSStore that uses a mock http client of our choice, that returns fixed responses
Ideally I’d like c), however I don’t see a way to get there without hacking ResourcePool in some ugly way…
a) is used in some places already, however those tests are not run in a normal build, nor on Hudson, so in the end not such a good thing.
b) is interesting, and there are some nice libraries to setup such kind of tests, one that looks particularly nice is http://wiremock.org/ , and https://github.com/NanoHttpd/nanohttpd looks nice too.
Wiremock is really born to perform testing, has a nice fluent api to build mocks and expectations, and can be also used to record and replay conversations with another server. Downside, it’s large-ish (has quite a bit of dependencies, or comes with a 5MB standalone version), I don’t see a mailing list for the project, and some of its dependencies are XML related, which worries me a bit (we already had issues with geotools xml parsers/encoders when adding extra xml related stuff in the classpath).
Nanohttp is nice in that it’s really small (under 30KB), however it does not seem to be available on maven repos (could not find it at least, but not the end of the world), and by the docs only supports GET/POST with a bit of PUT, so we could not use it in the future if we want to test communications with a remote RESTful service (something we don’t need now, but…)
An issue with tests that do open a HTTP port is that the port could be busy, and the test need to be hardened against that, with some test and retry logic (e.g, try 100 random ports above 8080, fail if they are all busy). This does not seem to hard to code though, and in fact a server socket can be bound to port 0 to make it found a free port by itself… managed to patch Nanohttp in 5 minutes to support that and return the port it actually bound to.
Anyways… suggestions?
Cheers
Andrea
–
==
GeoServer training in Milan, 6th & 7th June 2013! Visit http://geoserver.geo-solutions.it for more information.
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it