[Geoserver-devel] A test randomly driving me nuts ...

Hi,
I do have a test that is driving me nuts in a rather random fashion…
ManifestLoaderTest$ManifestPropertiesTest.filterExcludingAttributes

This test normally works, but randomly, don’t know exactly how, the test ends up failing and finds the property that was supposed to be excluded.
At that point it starts failing continuously, both from Maven and Eclipse, no matter if I clean the build or not.

After a bit of head banging I noticed that when the test fails when a manifest.properties file appears on the root of the main module (you know, at the same level as pom.xml).

Unfortunately before examining its contents I deleted it, and magically, the start started working properly instead.

Now, I looked at what code could create that file in the root of the module, and the only line I’ve found is line 220 in the same test class:

properties = new File(testData.getDataDirectoryRoot(), ManifestLoader.PROPERTIES_FILE);

Now, this line can end up writing in the root if testData.getDataDirectoryRoot() returns null… which seems an impossible occurrence.
Soo… it seems I’ve got a whole lot of nothing on why the test might generate a file there.

I’m very tempted to just add some code that checks if the manifest.properties is in the root, and kill it, while the test is setting up.

Better ideas?

Cheres
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


Andrea,

···

Now, this line can end up writing in the root if testData.getDataDirectoryRoot() returns null… which seems an impossible occurrence.
Soo… it seems I’ve got a whole lot of nothing on why the test might generate a file there.

I’m very tempted to just add some code that checks if the manifest.properties is in the root, and kill it, while the test is setting up.

Supposing that testData.getDataDirectoryRoot() already has its own tests, we could try to check for the returned parent path.

If (testData.getDataDirectoryRoot()==null){
LOG.WARN(“Unable to get the data_dir”);
ignore_test=true; // ignore next tests
return;
}

Anyhow this is quite strange and may never happen (right?).

Better ideas?

Cheres
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


==
GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
mobile: +39 3371094494
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Mon, May 20, 2013 at 10:07 AM, carlo cancellieri <
carlo.cancellieri@anonymised.com> wrote:

Andrea,

Now, this line can end up writing in the root if

testData.getDataDirectoryRoot() returns null... which seems an impossible
occurrence.
Soo... it seems I've got a whole lot of nothing on why the test might
generate a file there.

I'm very tempted to just add some code that checks if the
manifest.properties is in the root, and kill it, while the test is setting
up.

Supposing that testData.getDataDirectoryRoot() already has its own tests,
we could try to check for the returned parent path.

If (testData.getDataDirectoryRoot()==null){
   LOG.WARN("Unable to get the data_dir");
   ignore_test=true; // ignore next tests
   return;
}

Anyhow this is quite strange and may never happen (right?).

That's what I thought as well, yet something has been putting that
manifest.properties in the main module root...
and I'm not even sure if the testing code is to blame.
That's why I was proposing to harden the test, so that if the file
magically pops up there, the test code removes
it

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

-------------------------------------------------------