Bug 250527 - [mirror] Stack traces when running the mirroring tests
Summary: [mirror] Stack traces when running the mirroring tests
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.5   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.5 M4   Edit
Assignee: Andrew Cattle CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-10-11 21:53 EDT by Pascal Rapicault CLA
Modified: 2008-11-17 00:59 EST (History)
1 user (show)

See Also:


Attachments
Stops stack tracing from printing, uses IStatus returned from getRawArtifact (8.03 KB, patch)
2008-10-15 14:59 EDT, Andrew Cattle CLA
dj.houghton: iplog+
Details | Diff
Adds test to test precense of new arguements (2.82 KB, patch)
2008-10-22 14:23 EDT, Andrew Cattle CLA
dj.houghton: iplog+
Details | Diff
Adds test case to ensure ingoreErrors is respected (1.93 KB, patch)
2008-11-10 09:47 EST, Andrew Cattle CLA
john.arthorne: iplog+
Details | Diff
Adds test data known to throw an error (1.59 KB, application/zip)
2008-11-10 09:47 EST, Andrew Cattle CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault CLA 2008-10-11 21:53:49 EDT
When I'm running the following tests, stack traces appear in the console. Is this expected?
I'm afraid that we are getting exceptions that are not propagated and the tests pass where they should fail.

ArtifactMirrorApplicationTest [line: 405] - testArtifactMirrorToPartialDuplicateWithAppend()
ArtifactMirrorApplicationTest [line: 439] - testArtifactMirrorToPopulatedWithFullDuplicateWithAppend()
ArtifactMirrorApplicationTest [line: 473] - testArtifactMirrorToPopulatedWithPartialDuplicateWithAppend()
ArtifactMirrorApplicationTest [line: 640] - testArtifactMirrorSourceIsDestination()
ArtifactMirrorApplicationTest [entry] - testArtifactMirrorToFullDuplicateWithAppend()
Comment 1 Andrew Cattle CLA 2008-10-14 10:42:11 EDT
Here's what I have so far:
-The stack traces only occur with tests where "-append" is present and only after the repo is populated.

- the mirror method calls getOutputStream which checks if the descriptor passed to it is already in the repository. If it is then it throws a ProvisionException which is then caught and printed as a stack trace with the comment "//TODO is it OK to ignore this result?"

-The "Artifact repository out of sync" message is only displayed if a file exists on disk but is not actually in the repository.

So if an artifact is already in the repository we throw an error and move on to the next descriptor. If the file exists on disk but the repository doesn't have any knowledge of it then the file is deleted and the new one is downloaded.

Do we make the assumption that if a descriptor is in a repository it is correct and not overwrite it, assume it is outdated and overwrite it, or create a new preference that lets the use choose which behaviour they want?
Comment 2 Andrew Cattle CLA 2008-10-15 14:59:49 EDT
Created attachment 115179 [details]
Stops stack tracing from printing, uses IStatus returned from getRawArtifact

Changes exceptions thrown in Mirroring#mirror to returned statuses which are processed in MirrorApplication. Adds new arguements "verbose" which makes the application verbose and "ignoreErrors" which allows the application to continue even if an exception occurs.

Changed ArtifactMirrorApplicationTest to use these arguments.
Comment 3 Andrew Cattle CLA 2008-10-15 15:00:53 EDT
Comment this patch may solve Bug 250204
Comment 4 DJ Houghton CLA 2008-10-15 17:26:34 EDT
I have made changes to the code and released it but I will leave this open until we have regression tests for the new command-line args. 

Comment 5 Andrew Cattle CLA 2008-10-16 08:24:30 EDT
(In reply to comment #4)
> I have made changes to the code and released it but I will leave this open
> until we have regression tests for the new command-line args. 
> 

Currently they only print to the console. Is there an automated way to verify the console contents? All the test cases currently have "-verbose" included by default.
Comment 6 DJ Houghton CLA 2008-10-16 15:09:32 EDT
Not sure but minimally we need to call the application with all variants of the arguments to ensure that all code paths are taken.

Comment 7 Andrew Cattle CLA 2008-10-22 14:23:49 EDT
Created attachment 115843 [details]
Adds test to test precense of new arguements

I'm not really too happy with these 2 test cases but they're a start. To truly verify the effect of "-verbose" I'd need to be able to read what's printed to the console or a log file. Similarly to properly test the "-ignoreErrors" argument I'd need a repo that is known to throw an error during mirroring that I'm not quick sure how to build.

I'd welcome any advice.
Comment 8 Pascal Rapicault CLA 2008-10-29 12:20:22 EDT
Changing the target milestone as we are not contributing to M3. However please make sure these bugs are addressed early in M4 or tomorrow Testing Thursday for the test related ones.
Comment 9 Andrew Cattle CLA 2008-11-10 09:47:01 EST
Created attachment 117435 [details]
Adds test case to ensure ingoreErrors is respected

Uses attached test data.

This test runs the mirror application on a repository with an artifact in the xml but not on disk. the expected result is the remaining artifacts are mirrored correctly.

Unfortunately, because the order in which an artifact is mirrored is not consistent, I cannot test the absence of this argument.
Comment 10 Andrew Cattle CLA 2008-11-10 09:47:52 EST
Created attachment 117436 [details]
Adds test data known to throw an error

For use with the previously attached test case.
Comment 11 Pascal Rapicault CLA 2008-11-13 15:48:40 EST
Thx. Test released.