Skip to content

Commit

Permalink
Speed up running the tests of the IO module from Maven
Browse files Browse the repository at this point in the history
The `mvn test` command, when run in the IO module, now takes 15 seconds instead of 5 minutes.
This has been achieved by moving many of the tests to the verification phase instead of the test phase, by running them with the failsafe plugin instead of surefire.
Also, the tests are now executed in parallel.
  • Loading branch information
chrisvest committed Nov 21, 2015
1 parent d528248 commit 257cca2
Show file tree
Hide file tree
Showing 15 changed files with 982 additions and 721 deletions.
7 changes: 7 additions & 0 deletions community/io/pom.xml
Expand Up @@ -120,6 +120,13 @@ the relevant Commercial Agreement.
</jvmArgs> </jvmArgs>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>methods</parallel>
<perCoreThreadCount>2</perCoreThreadCount>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>


Expand Down
Expand Up @@ -94,14 +94,14 @@ public boolean mkdir( File fileName )
@Override @Override
public void mkdirs( File path ) throws IOException public void mkdirs( File path ) throws IOException
{ {
if (path.exists()) if ( path.exists() )
{ {
return; return;
} }


boolean directoriesWereCreated = path.mkdirs(); path.mkdirs();


if (directoriesWereCreated) if ( path.exists() )
{ {
return; return;
} }
Expand Down
Expand Up @@ -84,20 +84,16 @@ public FileSystemAbstractionInterruptionTest( @SuppressWarnings( "UnusedParamete
fs = factory.newInstance(); fs = factory.newInstance();
} }


@Before
public void interruptPriorToCall()
{
Thread.currentThread().interrupt();
}

@Before @Before
public void createWorkingDirectoryAndTestFile() throws IOException public void createWorkingDirectoryAndTestFile() throws IOException
{ {
Thread.interrupted();
fs.mkdirs( testdir.directory() ); fs.mkdirs( testdir.directory() );
file = testdir.file( "a" ); file = testdir.file( "a" );
fs.create( file ).close(); fs.create( file ).close();
channel = null; channel = null;
channelShouldBeClosed = false; channelShouldBeClosed = false;
Thread.currentThread().interrupt();
} }


private StoreChannel channel; private StoreChannel channel;
Expand Down

0 comments on commit 257cca2

Please sign in to comment.