Issue Details (XML | Word | Printable)

Key: CONTINUUM-968
Type: Test Test
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Emmanuel Venisse
Reporter: Philippe Faes
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Continuum

Tests for continuum-release fail randomly

Created: 23/Oct/06 02:01 AM   Updated: 22/Jan/07 07:16 AM
Component/s: Testing
Affects Version/s: 1.1-alpha-1
Fix Version/s: 1.1-alpha-1

Time Tracking:
Not Specified

File Attachments: 1. File continuum-release.diff (2 kB)

Environment: tests fail for some environments and pass for others. For some they fail at random

Complexity: Intermediate
Testcase included: yes


 Description  « Hide
The test for continuum-release fails randomly. This is because the two test methods are executed in a random order (this is intended JUnit behavior), and the tests alter files.

Solution is to restore files between tests (method setUp) and to force the order of the two tests (create one test method that calls the two other methods one by one).

Patch is attached. Please verify and commit.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jesse McConnell added a comment - 23/Oct/06 05:23 PM
Why can't the state of the files just be returned to normal after each test case completes and then work within the intended junit behavior?

Philippe Faes added a comment - 24/Oct/06 02:20 AM
It can't because testReleaseSimpleProject() makes changes to the repository that are needed by testReleaseSimpleProjectWithNextVersion. The former can be executed alone, but the latter needs the former in order to pass. testReleaseSimple expects to find 1.0-SNAPSHOT in the repo, whil testReleaseSimpleWithNextVersion expects 1.1-SNAPSHOT.

Bottom line: both methods comprise ONE test, not two.


Jesse McConnell added a comment - 24/Oct/06 10:41 AM
patch applied, thank you much!

Wendy Smoak added a comment - 30/Oct/06 09:25 AM
I'm still seeing a (repeatable) test failure in continuum-release. (Windows XP and Cygwin.)

console output:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest
[INFO] Executing: svn --non-interactive checkout file://localhost/c:/svn/maven/c
ontinuum/continuum-release/target/scm-test/trunk work-dir
[INFO] Working directory: c:\svn\maven\continuum\continuum-release\target\test-classes
[INFO] Verifying that there are no local modifications...
[INFO] Executing: svn --non-interactive status
[INFO] Working directory: c:\svn\maven\continuum\continuum-release\target\test-classes\work-dir
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'Simple Project'...
[INFO] Checking in modified POMs...
[INFO] Executing: svn --non-interactive commit --file c:\DOCUME~1\wsmoak\LOCALS~1\Temp\maven-scm-1838657772.commit c:/svn/maven/continuum/continuum-release/target/test-classes/work-dir/pom.xml
[INFO] Working directory: c:\svn\maven\continuum\continuum-release\target\test-classes\work-dir
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.265 sec <<< FAILURE!

Results :
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Surefire output:

$ cat target/surefire-reports/*.txt
-------------------------------------------------------------------------------
Test set: org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.265 sec <<< FAILURE!
testReleases(org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest) Time elapsed: 3.172 sec <<< FAILURE!
junit.framework.AssertionFailedError: Error in release:prepare. Release output follows:
[INFO] Verifying that there are no local modifications...
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'Simple Project'...
[ERROR] org.apache.maven.shared.release.scm.ReleaseScmCommandException: Unable to commit files
Provider message:
The svn command failed.
Command output:
svn: '/cygdrive/c/svn/maven/continuum/continuum-release/target/test-classes/work-dir/c:/svn/maven/continuum/continuum-release/target/test-classes/work-dir' is not a working copy

at org.apache.maven.shared.release.phase.ScmCommitPhase.execute(ScmCommitPhase.java:102)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:202)
at org.apache.maven.shared.release.DefaultReleaseManager.prepareWithResult(DefaultReleaseManager.java:108)
at org.apache.maven.continuum.release.executors.PrepareReleaseTaskExecutor.executeTask(PrepareReleaseTaskExecutor.java:81)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.doPrepareWithNoError(ReleaseTaskExecutorTest.java:166)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.releaseSimpleProject(ReleaseTaskExecutorTest.java:101)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.testReleases(ReleaseTaskExecutorTest.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

at junit.framework.Assert.fail(Assert.java:47)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.doPrepareWithNoError(ReleaseTaskExecutorTest.java:171)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.releaseSimpleProject(ReleaseTaskExecutorTest.java:101)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.testReleases(ReleaseTaskExecutorTest.java:115)


Joakim Erdfelt added a comment - 30/Oct/06 10:06 AM
Reopening because issue still remains.

Barrie Treloar added a comment - 01/Nov/06 01:10 AM
The error may be in maven-release-manager but there is no source attached when the snapshot was deployed.

I've downloaded the trunk of maven-release-manager but this fails for different reasons.


thierry lach added a comment - 01/Nov/06 09:02 AM
I'm getting a consistent fail with the following output from surefire:

------------------------------------------------------------------------------
Test set: org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.932 sec <<< FAILURE!
testReleases(org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest) Time elapsed: 3.869 sec <<< ERROR!
java.io.FileNotFoundException: C:\continuum-1.1-src\continuum-release\target\test-classes\work-dir\pom.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at org.codehaus.plexus.util.FileUtils.fileRead(FileUtils.java:273)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.releaseSimpleProject(ReleaseTaskExecutorTest.java:98)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.testReleases(ReleaseTaskExecutorTest.java:115)

and the following output on the console....

[INFO] Surefire report directory: C:\continuum-1.1-src\continuum-release\target\surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest
[INFO] Executing: svn --non-interactive checkout file://localhost/C:/continuum-1.1-src/continuum-release/target/scm-test/trunk work-dir
[INFO] Working directory: C:\continuum-1.1-src\continuum-release\target\test-classes
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.948 sec <<< FAILURE!

Results :
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 16 seconds
[INFO] Finished at: Wed Nov 01 09:46:54 EST 2006
[INFO] Final Memory: 15M/28M
[INFO] ------------------------------------------------------------------------

When I try the svn command manually, I get....

C:\continuum-1.1-src>svn --non-interactive checkout file://localhost/C:/continuum-1.1-src/continuum-release/target/scm-test/trunk work-dir
svn: Unable to open an ra_local session to URL
svn: Unable to open repository 'file://localhost/C:/continuum-1.1-src/continuum-release/target/scm-test/trunk'

C:\continuum-1.1-src>

But I can use svnadmin to verify the repository...

C:\continuum-1.1-src>svnadmin verify C:/continuum-1.1-src/continuum-release/target/scm-test

  • Verified revision 0.
  • Verified revision 1.
  • Verified revision 2.

C:\continuum-1.1-src>

Hopefully this will help....


thierry lach added a comment - 01/Nov/06 09:14 AM
Oh - and just in case this is significant......

C:\continuum-1.1-src>svn --version
svn, version 1.2.3 (r15833)
compiled Sep 13 2005, 22:45:22

Copyright (C) 2000-2005 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

  • ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
  • handles 'http' scheme
  • handles 'https' scheme
  • ra_svn : Module for accessing a repository using the svn network protocol.
  • handles 'svn' scheme
  • ra_local : Module for accessing a repository on local disk.
  • handles 'file' scheme

C:\continuum-1.1-src>


Barrie Treloar added a comment - 02/Nov/06 12:22 AM
I'm working off HEAD (revision 470234) with a local snapshot build of maven-release-manager.
Windows XP (no cygwin)

Trying mvn clean install from project root fails at continuum-release with the reason that:

junit.framework.AssertionFailedError: Test released version
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.releaseSimpleProject(ReleaseTaskExecutorTest.java:111)
at org.apache.maven.continuum.release.executors.ReleaseTaskExecutorTest.testReleases(ReleaseTaskExecutorTest.java:115)

If go into the continuum-release module and run mvn clean it will sometimes work and sometimes fail with the same error.

Because this error is intermittent it feels like a timing issue with the Microsoft clock not being accurate enough. If I remember rightly it is only even milliseconds or something. This might be causing the issue with the tests.
I remember that "mvn release:prepare" had similar issues too.


Emmanuel Venisse added a comment - 22/Jan/07 07:16 AM
Already fixed.