I changed the expire time from 5 to 10 and then changed the sleep time to 11000. That got the unit test to pass. I'm not sure what to do about this. Having a unit test rely on an external resource is very bad practice just for this reason. Worse, if I didn't have an active internet connection at all I couldn't run the unit tests at all, even if I did mvn -o.

This test case does have an interesting history. Up until Aug 23, 2006 it was using a local file. On that date is was modified to point at google. On March 7, 2007 it was modified to point to slashdot with the comment that google's content type is inconsistent. At that time the expire time was set to 1. It was changed to 2 on May 1, 2007 and then to 5 on Nov 13, 2007. Apparently it still doesn't work everywhere. So the question is, why was it changed from using a local file in the first place?

I'm really hesitant to just up it to 10.

Ralph

Ralph Goers wrote:
I put slashdot.org in my browser on that machine and it took quite a while to display but it did. I notice that the unit tests pause for quite a while on that test. I'm not sure why.

Anyway, I changed the 5 to 30 and it still fails. Should unit tests really be going to external resources?

Ralph

Joerg Heinicke wrote:
On 08.01.2008 23:23, Joerg Heinicke wrote:

But I am still getting 1 unit test failure in cocoon core - CachingSourceTestCase is failing on line 88. How could this possibly have anything to do with what I changed?

Since our Continuum build now runs successful it seems to be an issue with your environment.

Or - since it goes to a remote source - 5 s is just too short;

public void testCachingURI() throws Exception {
    String uri = "cached:http://slashdot.org/?cocoon:cache-expires=5";;

    CachingSource source;

    source = (CachingSource) resolver.resolveURI(uri);
    CachingSource.SourceMeta meta1 = source.getResponseMeta();
    resolver.release(source);

    source = (CachingSource) resolver.resolveURI(uri);
    CachingSource.SourceMeta meta2 = source.getResponseMeta();
    resolver.release(source);

    // Source is cached -- same meta data
    assertSame(meta1, meta2);

If this test fails reliably for you can you please try to increase the cache-expires parameter on the uri?

Joerg

Reply via email to